/** <a href="http://www.cpupk.com/decompiler">Eclipse Class Decompiler</a> plugin, Copyright (c) 2017 Chen Chao. **/
package com.minierp.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.minierp.bean.BusinessBillBean;
import com.minierp.bean.BusinessBillItemBean;
import com.minierp.bean.ClieUserBean;
import com.minierp.bean.InOutDetailBean;
import com.minierp.bean.OrderParameterCarrier;
import com.minierp.bean.QueryParameterBean;
import com.minierp.bean.QueryResult;
import com.minierp.bean.ReceivableAgeBean;
import com.minierp.bean.ReceivableAgeBeanComparator;
import com.minierp.bean.UserBean;
import com.minierp.bean.UserStatus;
import com.minierp.dao.AccessoryDao;
import com.minierp.dao.AdjustBillDao;
import com.minierp.dao.AdjustBillItemDao;
import com.minierp.dao.AreaDao;
import com.minierp.dao.BankAccountBalanceDao;
import com.minierp.dao.BankAccountDao;
import com.minierp.dao.BankAccountDetailDao;
import com.minierp.dao.BusinessBillDao;
import com.minierp.dao.BusinessBillItemDao;
import com.minierp.dao.BusinessUpdateLogDao;
import com.minierp.dao.CodeRuleDao;
import com.minierp.dao.CooperBillDao;
import com.minierp.dao.CooperBillItemDao;
import com.minierp.dao.DeliverBillDao;
import com.minierp.dao.DepartmentDao;
import com.minierp.dao.EstablishmentContactDao;
import com.minierp.dao.EstablishmentLevelDao;
import com.minierp.dao.EstablishmentTypeDao;
import com.minierp.dao.FeeBillDao;
import com.minierp.dao.FeeTypeDao;
import com.minierp.dao.FinanceDetailDao;
import com.minierp.dao.IdGenerator;
import com.minierp.dao.MakeTypeDao;
import com.minierp.dao.MessageDao;
import com.minierp.dao.OutBillDao;
import com.minierp.dao.OutBillItemDao;
import com.minierp.dao.OutputDao;
import com.minierp.dao.PayModeDao;
import com.minierp.dao.PrintLogDao;
import com.minierp.dao.ProductDao;
import com.minierp.dao.QueryDao;
import com.minierp.dao.ReceiveBillDao;
import com.minierp.dao.ReceiveBillItemDao;
import com.minierp.dao.SerialNumberDao;
import com.minierp.dao.SetuBillDao;
import com.minierp.dao.SmsAlertDao;
import com.minierp.dao.StafferDao;
import com.minierp.dao.StockBalanceDao;
import com.minierp.dao.StockDao;
import com.minierp.dao.TallySetDao;
import com.minierp.dao.WorkCenterDao;
import com.minierp.dao.WorkProcessDao;
import com.minierp.err.NotAllowException;
import com.minierp.err.PermissionDennyException;
import com.minierp.err.StockNoEnoughException;
import com.minierp.helper.EncBusinessBillMACtrHelper;
import com.minierp.helper.EncCommonHelper;
import com.minierp.helper.EncInterceptorHelper;
import com.minierp.helper.PageHelper;
import com.minierp.model.Accessory;
import com.minierp.model.AdjustBill;
import com.minierp.model.BankAccount;
import com.minierp.model.BusinessBill;
import com.minierp.model.BusinessBillExt;
import com.minierp.model.BusinessBillItem;
import com.minierp.model.BusinessBillItemExt;
import com.minierp.model.BusinessProfit;
import com.minierp.model.BusinessUpdateLog;
import com.minierp.model.CodeRule;
import com.minierp.model.CooperBill;
import com.minierp.model.DeliverBill;
import com.minierp.model.Department;
import com.minierp.model.EnterpriseInfo;
import com.minierp.model.Establishment;
import com.minierp.model.EstablishmentContact;
import com.minierp.model.EstablishmentLevel;
import com.minierp.model.FeeBillItem;
import com.minierp.model.GatherBill;
import com.minierp.model.MakeType;
import com.minierp.model.OutBill;
import com.minierp.model.PrintLog;
import com.minierp.model.Product;
import com.minierp.model.ReceiveBill;
import com.minierp.model.SetuBill;
import com.minierp.model.SmsAlert;
import com.minierp.model.Storehouse;
import com.minierp.model.TallySet;
import com.minierp.model.WorkCenter;
import com.minierp.model.WorkProcess;
import com.minierp.service.BusinessBillService;
import com.minierp.view.BusinessBillExcelView;
import com.minierp.view.BusinessBillItemListExcelView;
import com.minierp.view.BusinessBillListExcelView;
import com.minierp.view.BusinessBillListForAccountExcelView;
import com.minierp.view.BusinessBillListForAccountPrintExcelView;
import com.minierp.view.BusinessBillListForCloseExcelView;
import com.minierp.view.BusinessBillListForOutputExcelView;
import com.minierp.view.BusinessBillListForReceiveExcelView;
import com.minierp.view.BusinessBillListForTaskExcelView;
import com.minierp.view.BusinessLogListExcelView;
import com.minierp.view.BusinessProfitDetailExcelView;
import com.minierp.view.BusinessProfitListExcelView;
import com.minierp.view.EstBackCountExcelView;
import com.minierp.view.EstBusinessCountExcelView;
import com.minierp.view.MtBusinessCountExcelView;
import com.minierp.view.MtBusinessDateExcelView;
import com.minierp.view.ReceivableAgeListExcelView;
import com.minierp.view.ReceivableListExcelView;
import com.minierp.view.StafferExploitListExcelView;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.Region;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import org.springframework.dao.CannotAcquireLockException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

public class BusinessBillMACtr extends MultiActionController {
	private BusinessBillDao businessBillDao;
	private BusinessBillItemDao businessBillItemDao;
	private AccessoryDao accessoryDao;
	private DepartmentDao departmentDao;
	private EstablishmentTypeDao establishmentTypeDao;
	private EstablishmentLevelDao establishmentLevelDao;
	private EstablishmentContactDao establishmentContactDao;
	private AreaDao areaDao;
	private MakeTypeDao makeTypeDao;
	private QueryDao queryDao;
	private ReceiveBillItemDao receiveBillItemDao;
	private AdjustBillItemDao adjustBillItemDao;
	private ReceiveBillDao receiveBillDao;
	private AdjustBillDao adjustBillDao;
	private BankAccountBalanceDao bankAccountBalanceDao;
	private BankAccountDetailDao bankAccountDetailDao;
	private TallySetDao tallySetDao;
	private SmsAlertDao smsAlertDao;
	private CooperBillItemDao cooperBillItemDao;
	private FeeBillDao feeBillDao;
	private StockDao stockDao;
	private StockBalanceDao stockBalanceDao;
	private CodeRuleDao codeRuleDao;
	private MessageDao messageDao;
	private FinanceDetailDao financeDetailDao;
	private WorkCenterDao workCenterDao;
	private WorkProcessDao workProcessDao;
	private OutBillDao outBillDao;
	private OutBillItemDao outBillItemDao;
	private DeliverBillDao deliverBillDao;
	private SetuBillDao setuBillDao;
	private CooperBillDao cooperBillDao;
	private BusinessBillService businessBillService;
	private BusinessUpdateLogDao businessUpdateLogDao;
	private OutputDao outputDao;
	private PrintLogDao printLogDao;
	private PayModeDao payModeDao;
	private BankAccountDao bankAccountDao;
	private StafferDao stafferDao;
	private FeeTypeDao feeTypeDao;
	private ProductDao productDao;
	private SerialNumberDao serialNumberDao;
	private IdGenerator idGenerator;
	private DataSource dataSource;
	private String listForAccessoryView;
	private String infoForAccessoryView;
	private String listForExamineView;
	private String dialogSuccessView;
	private String infoForExamineView;
	private String listForUnExamineView;
	private String infoForUnExamineView;
	private String listForReorderView;
	private String listForCancelView;
	private String infoForCancelView;
	private String listForCompleteView;
	private String infoForCompleteView;
	private String listForUnCompleteView;
	private String infoForUnCompleteView;
	private String listForCloseView;
	private String infoForCloseView;
	private String listForUnCloseView;
	private String infoForUnCloseView;
	private String listForMakeView;
	private String listForDeliverView;
	private String listForSelectView;
	private String listForReceiveView;
	private String listForEstablishmentView;
	private String listForAccountFormView;
	private String listForAccountView;
	private String searchResultView;
	private String byDateForReceiveView;
	private String printView;
	private String printSimpleView;
	private String printMakeView;
	private String printLittleView;
	private String printLabelView;
	private String printPackageView;
	private String printReceView;
	private String printSaleView;
	private String receivableListView;
	private String itemListForEstablishmentView;
	private String listForEditPriceView;
	private String listForModifyView;
	private String itemListAloneView;
	private String itemListForSelectView;
	private String itemSearchResultView;
	private String selectMakerView;
	private String itemListForCooperSelectView;
	private String itemListForCooperMultiSelectView;
	private String profitSearchResultView;
	private String profitDetailView;
	private String listForModifySelfView;
	private String listForOutputView;
	private String infoView;
	private String listForCooCompView;
	private String infoForCooCompView;
	private String listForCooUnCompView;
	private String infoForCooUnCompView;
	private String listForCooperView;
	private String receivableCountView;
	private String relBillListView;
	private String relBillCancelView;
	private String estBusinessCountView;
	private String estBackCountView;
	private String businessDateCountView;
	private String businessDateCountPrintView;
	private String stafferExploitListView;
	private String setStafferRateView;
	private String mtBusinessCountView;
	private String mtBusinessDateView;
	private String businessLogListView;
	private String listForTaskView;
	private String infoForProView;
	private String listForOvView;
	private String receivableAgeListView;
	private String businessFileUploadView;
	private String businessBillPrintSelectView;
	private String infoForLabelView;
	private String impoFormView;
	private String acceSearView;
	private String listForSetuView;
	private String busiBillListView;
	private String busiCounView;
	private String payListView;
	private String busiAccoFormView;
	private String busiAccoView;

	public String getBusiAccoFormView() {
		return this.busiAccoFormView;
	}

	public void setBusiAccoFormView(String busiAccoFormView) {
		this.busiAccoFormView = busiAccoFormView;
	}

	public String getBusiAccoView() {
		return this.busiAccoView;
	}

	public void setBusiAccoView(String busiAccoView) {
		this.busiAccoView = busiAccoView;
	}

	public String getPayListView() {
		return this.payListView;
	}

	public void setPayListView(String payListView) {
		this.payListView = payListView;
	}

	public String getBusiCounView() {
		return this.busiCounView;
	}

	public void setBusiCounView(String busiCounView) {
		this.busiCounView = busiCounView;
	}

	public String getBusiBillListView() {
		return this.busiBillListView;
	}

	public void setBusiBillListView(String busiBillListView) {
		this.busiBillListView = busiBillListView;
	}

	public ProductDao getProductDao() {
		return this.productDao;
	}

	public void setProductDao(ProductDao productDao) {
		this.productDao = productDao;
	}

	public String getPrintSaleView() {
		return this.printSaleView;
	}

	public void setPrintSaleView(String printSaleView) {
		this.printSaleView = printSaleView;
	}

	public SetuBillDao getSetuBillDao() {
		return this.setuBillDao;
	}

	public void setSetuBillDao(SetuBillDao setuBillDao) {
		this.setuBillDao = setuBillDao;
	}

	public String getListForSetuView() {
		return this.listForSetuView;
	}

	public void setListForSetuView(String listForSetuView) {
		this.listForSetuView = listForSetuView;
	}

	public String getAcceSearView() {
		return this.acceSearView;
	}

	public void setAcceSearView(String acceSearView) {
		this.acceSearView = acceSearView;
	}

	public String getImpoFormView() {
		return this.impoFormView;
	}

	public void setImpoFormView(String impoFormView) {
		this.impoFormView = impoFormView;
	}

	public OutBillItemDao getOutBillItemDao() {
		return this.outBillItemDao;
	}

	public void setOutBillItemDao(OutBillItemDao outBillItemDao) {
		this.outBillItemDao = outBillItemDao;
	}

	public StockBalanceDao getStockBalanceDao() {
		return this.stockBalanceDao;
	}

	public void setStockBalanceDao(StockBalanceDao stockBalanceDao) {
		this.stockBalanceDao = stockBalanceDao;
	}

	public SerialNumberDao getSerialNumberDao() {
		return this.serialNumberDao;
	}

	public void setSerialNumberDao(SerialNumberDao serialNumberDao) {
		this.serialNumberDao = serialNumberDao;
	}

	public String getPrintPackageView() {
		return this.printPackageView;
	}

	public void setPrintPackageView(String printPackageView) {
		this.printPackageView = printPackageView;
	}

	public String getInfoForLabelView() {
		return this.infoForLabelView;
	}

	public void setInfoForLabelView(String infoForLabelView) {
		this.infoForLabelView = infoForLabelView;
	}

	public String getPrintLabelView() {
		return this.printLabelView;
	}

	public void setPrintLabelView(String printLabelView) {
		this.printLabelView = printLabelView;
	}

	public String getListForAccountView() {
		return this.listForAccountView;
	}

	public void setListForAccountView(String listForAccountView) {
		this.listForAccountView = listForAccountView;
	}

	public String getPrintReceView() {
		return this.printReceView;
	}

	public void setPrintReceView(String printReceView) {
		this.printReceView = printReceView;
	}

	public String getBusinessBillPrintSelectView() {
		return this.businessBillPrintSelectView;
	}

	public void setBusinessBillPrintSelectView(
			String businessBillPrintSelectView) {
		this.businessBillPrintSelectView = businessBillPrintSelectView;
	}

	public String getBusinessFileUploadView() {
		return this.businessFileUploadView;
	}

	public void setBusinessFileUploadView(String businessFileUploadView) {
		this.businessFileUploadView = businessFileUploadView;
	}

	public String getReceivableAgeListView() {
		return this.receivableAgeListView;
	}

	public void setReceivableAgeListView(String receivableAgeListView) {
		this.receivableAgeListView = receivableAgeListView;
	}

	public String getProfitDetailView() {
		return this.profitDetailView;
	}

	public void setProfitDetailView(String profitDetailView) {
		this.profitDetailView = profitDetailView;
	}

	public String getListForOvView() {
		return this.listForOvView;
	}

	public void setListForOvView(String listForOvView) {
		this.listForOvView = listForOvView;
	}

	public String getInfoForProView() {
		return this.infoForProView;
	}

	public void setInfoForProView(String infoForProView) {
		this.infoForProView = infoForProView;
	}

	public StafferDao getStafferDao() {
		return this.stafferDao;
	}

	public void setStafferDao(StafferDao stafferDao) {
		this.stafferDao = stafferDao;
	}

	public String getListForTaskView() {
		return this.listForTaskView;
	}

	public void setListForTaskView(String listForTaskView) {
		this.listForTaskView = listForTaskView;
	}

	public String getBusinessLogListView() {
		return this.businessLogListView;
	}

	public void setBusinessLogListView(String businessLogListView) {
		this.businessLogListView = businessLogListView;
	}

	public String getItemListForCooperMultiSelectView() {
		return this.itemListForCooperMultiSelectView;
	}

	public void setItemListForCooperMultiSelectView(
			String itemListForCooperMultiSelectView) {
		this.itemListForCooperMultiSelectView = itemListForCooperMultiSelectView;
	}

	public String getMtBusinessCountView() {
		return this.mtBusinessCountView;
	}

	public void setMtBusinessCountView(String mtBusinessCountView) {
		this.mtBusinessCountView = mtBusinessCountView;
	}

	public String getSetStafferRateView() {
		return this.setStafferRateView;
	}

	public void setSetStafferRateView(String setStafferRateView) {
		this.setStafferRateView = setStafferRateView;
	}

	public PrintLogDao getPrintLogDao() {
		return this.printLogDao;
	}

	public void setPrintLogDao(PrintLogDao printLogDao) {
		this.printLogDao = printLogDao;
	}

	public String getStafferExploitListView() {
		return this.stafferExploitListView;
	}

	public void setStafferExploitListView(String stafferExploitListView) {
		this.stafferExploitListView = stafferExploitListView;
	}

	public String getBusinessDateCountView() {
		return this.businessDateCountView;
	}

	public void setBusinessDateCountView(String businessDateCountView) {
		this.businessDateCountView = businessDateCountView;
	}

	public String getEstBackCountView() {
		return this.estBackCountView;
	}

	public void setEstBackCountView(String estBackCountView) {
		this.estBackCountView = estBackCountView;
	}

	public String getEstBusinessCountView() {
		return this.estBusinessCountView;
	}

	public void setEstBusinessCountView(String estBusinessCountView) {
		this.estBusinessCountView = estBusinessCountView;
	}

	public String getRelBillListView() {
		return this.relBillListView;
	}

	public void setRelBillListView(String relBillListView) {
		this.relBillListView = relBillListView;
	}

	public String getRelBillCancelView() {
		return this.relBillCancelView;
	}

	public void setRelBillCancelView(String relBillCancelView) {
		this.relBillCancelView = relBillCancelView;
	}

	public DeliverBillDao getDeliverBillDao() {
		return this.deliverBillDao;
	}

	public void setDeliverBillDao(DeliverBillDao deliverBillDao) {
		this.deliverBillDao = deliverBillDao;
	}

	public CooperBillDao getCooperBillDao() {
		return this.cooperBillDao;
	}

	public void setCooperBillDao(CooperBillDao cooperBillDao) {
		this.cooperBillDao = cooperBillDao;
	}

	public String getReceivableCountView() {
		return this.receivableCountView;
	}

	public void setReceivableCountView(String receivableCountView) {
		this.receivableCountView = receivableCountView;
	}

	public String getListForCooperView() {
		return this.listForCooperView;
	}

	public void setListForCooperView(String listForCooperView) {
		this.listForCooperView = listForCooperView;
	}

	public String getInfoForCooCompView() {
		return this.infoForCooCompView;
	}

	public void setInfoForCooCompView(String infoForCooCompView) {
		this.infoForCooCompView = infoForCooCompView;
	}

	public String getListForCooCompView() {
		return this.listForCooCompView;
	}

	public void setListForCooCompView(String listForCooCompView) {
		this.listForCooCompView = listForCooCompView;
	}

	public String getListForCooUnCompView() {
		return this.listForCooUnCompView;
	}

	public void setListForCooUnCompView(String listForCooUnCompView) {
		this.listForCooUnCompView = listForCooUnCompView;
	}

	public String getInfoForCooUnCompView() {
		return this.infoForCooUnCompView;
	}

	public void setInfoForCooUnCompView(String infoForCooUnCompView) {
		this.infoForCooUnCompView = infoForCooUnCompView;
	}

	public String getListForModifySelfView() {
		return this.listForModifySelfView;
	}

	public void setListForModifySelfView(String listForModifySelfView) {
		this.listForModifySelfView = listForModifySelfView;
	}

	public String getItemSearchResultView() {
		return this.itemSearchResultView;
	}

	public void setItemSearchResultView(String itemSearchResultView) {
		this.itemSearchResultView = itemSearchResultView;
	}

	public String getDialogSuccessView() {
		return this.dialogSuccessView;
	}

	public void setDialogSuccessView(String dialogSuccessView) {
		this.dialogSuccessView = dialogSuccessView;
	}

	public String getInfoForCancelView() {
		return this.infoForCancelView;
	}

	public void setInfoForCancelView(String infoForCancelView) {
		this.infoForCancelView = infoForCancelView;
	}

	public String getListForCancelView() {
		return this.listForCancelView;
	}

	public void setListForCancelView(String listForCancelView) {
		this.listForCancelView = listForCancelView;
	}

	public String getInfoForUnExamineView() {
		return this.infoForUnExamineView;
	}

	public void setInfoForUnExamineView(String infoForUnExamineView) {
		this.infoForUnExamineView = infoForUnExamineView;
	}

	public String getInfoForExamineView() {
		return this.infoForExamineView;
	}

	public void setInfoForExamineView(String infoForExamineView) {
		this.infoForExamineView = infoForExamineView;
	}

	public String getListForExamineView() {
		return this.listForExamineView;
	}

	public void setListForExamineView(String listForExamineView) {
		this.listForExamineView = listForExamineView;
	}

	public ModelAndView handleListForAccessory(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_ACCE")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForAccessoryView);
			String searchKey = request.getParameter("search_key");
			String tsId = request.getParameter("ts_id");
			long managerId = 0L;
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				managerId = ub.getStaffer().getId();
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			if (tsId == null || tsId.equals("")) {
				tsId = String.valueOf(ub.getUser().getDfTsId());
			}

			int perPageNum = EncCommonHelper.getPageSize(request);
			int total = this.businessBillDao.getListForAccessoryCount(
					searchKey, managerId, Long.parseLong(tsId), ub, allowStart,
					ent.getBusiUplo());
			int pageno = EncCommonHelper.getCurrentPageIndex(request, total,
					perPageNum);
			int startIndex = (pageno - 1) * perPageNum;
			List list = this.businessBillDao.getListForAccessory(searchKey,
					managerId, Long.parseLong(tsId), ub, allowStart,
					ent.getBusiUplo(), startIndex, perPageNum);
			mv.addObject("qr", EncCommonHelper.parseQueryResult(list, total,
					perPageNum, pageno));
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, ub));
			mv.addObject("wcList", this.workCenterDao.getList(false));
			mv.addObject("searchKey", searchKey);
			mv.addObject("tsId", tsId);
			return mv;
		}
	}

	public ModelAndView handleInfoForAccessory(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.infoForAccessoryView);
		String id = request.getParameter("id");
		String wcId = request.getParameter("wc_id");
		if (wcId == null || wcId.equals("")) {
			wcId = "0";
		}

		String isCooper = "";
		if (wcId.equals("0")) {
			isCooper = "Y";
		}

		List wcList = this.workCenterDao.getList(false);
		List depList = this.departmentDao.getList(false);
		List tsList = this.tallySetDao.getList(false);
		List payModeList = this.payModeDao.getList(false);
		List baList = this.bankAccountDao.getList("", "");
		List mtList = this.makeTypeDao.getList(false);
		mv.addObject("record", this.getBusinessBill(Long.parseLong(id), true,
				false, false, "", Long.parseLong(wcId), isCooper, "", false,
				mtList, baList, payModeList, depList, tsList, (List) null,
				(List) null));
		mv.addObject("workCenterList", wcList);
		mv.addObject("wcId", wcId);
		return mv;
	}

	public ModelAndView handleListForExamine(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_EXAM")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForExamineView);
			String searchKey = request.getParameter("search_key");
			String costType = request.getParameter("cost_type");
			String tsId = request.getParameter("ts_id");
			long managerId = 0L;
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				managerId = ub.getStaffer().getId();
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			if (tsId == null || tsId.equals("")) {
				tsId = String.valueOf(ub.getUser().getDfTsId());
			}

			List tsList = PageHelper.getTallySetList(this.tallySetDao, ub);
			int perPageNum = EncCommonHelper.getPageSize(request);
			int total = this.businessBillDao.getListForExamineCount(searchKey,
					costType, managerId, Long.parseLong(tsId), ub, allowStart);
			int pageno = EncCommonHelper.getCurrentPageIndex(request, total,
					perPageNum);
			int startIndex = (pageno - 1) * perPageNum;
			List list = this.businessBillDao.getListForExamine(searchKey,
					costType, managerId, Long.parseLong(tsId), ub, allowStart,
					startIndex, perPageNum);
			mv.addObject("qr", EncCommonHelper.parseQueryResult(list, total,
					perPageNum, pageno));
			mv.addObject("searchKey", searchKey);
			mv.addObject("tsId", tsId);
			mv.addObject("costType", costType);
			mv.addObject("tsList", tsList);
			return mv;
		}
	}

	public ModelAndView handleInfoForExamine(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.infoForExamineView);
		String id = request.getParameter("id");
		List wcList = this.workCenterDao.getList(false);
		List depList = this.departmentDao.getList(false);
		List tsList = this.tallySetDao.getList(false);
		List payModeList = this.payModeDao.getList(false);
		List baList = this.bankAccountDao.getList("", "");
		List mtList = this.makeTypeDao.getList(false);
		mv.addObject("record", this.getBusinessBill(Long.parseLong(id), true,
				false, false, "", 0L, "", "", false, mtList, baList,
				payModeList, depList, tsList, (List) null, (List) null));
		mv.addObject("workCenterList", wcList);
		return mv;
	}

	public ModelAndView handleListForUnExamine(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_UN_EXAM")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForUnExamineView);
			String searchKey = request.getParameter("search_key");
			String tsId = request.getParameter("ts_id");
			long managerId = 0L;
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				managerId = ub.getStaffer().getId();
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			if (tsId == null || tsId.equals("")) {
				tsId = String.valueOf(ub.getUser().getDfTsId());
			}

			List tsList = PageHelper.getTallySetList(this.tallySetDao, ub);
			int perPageNum = EncCommonHelper.getPageSize(request);
			int total = this.businessBillDao.getListForUnExamineCount(
					searchKey, managerId, Long.parseLong(tsId), ub, allowStart);
			int pageno = EncCommonHelper.getCurrentPageIndex(request, total,
					perPageNum);
			int startIndex = (pageno - 1) * perPageNum;
			List list = this.businessBillDao.getListForUnExamine(searchKey,
					managerId, Long.parseLong(tsId), ub, allowStart,
					startIndex, perPageNum);
			mv.addObject("qr", EncCommonHelper.parseQueryResult(list, total,
					perPageNum, pageno));
			mv.addObject("searchKey", searchKey);
			mv.addObject("tsId", tsId);
			mv.addObject("tsList", tsList);
			return mv;
		}
	}

	public ModelAndView handleInfoForUnExamine(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.infoForUnExamineView);
		String id = request.getParameter("id");
		List wcList = this.workCenterDao.getList(false);
		List depList = this.departmentDao.getList(false);
		List tsList = this.tallySetDao.getList(false);
		List payModeList = this.payModeDao.getList(false);
		List baList = this.bankAccountDao.getList("", "");
		List mtList = this.makeTypeDao.getList(false);
		mv.addObject("record", this.getBusinessBill(Long.parseLong(id), true,
				false, false, "", 0L, "", "", false, mtList, baList,
				payModeList, depList, tsList, (List) null, (List) null));
		mv.addObject("workCenterList", wcList);
		return mv;
	}

	public ModelAndView handleListForReorder(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_COPY")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForReorderView);
			String searchKey = request.getParameter("search_key");
			String clientId = request.getParameter("client_id");
			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			int perPageNum = EncCommonHelper.getPageSize(request);
			int total = this.businessBillDao.getListForReorderCount(
					Long.parseLong(clientId), searchKey,
					EncCommonHelper.getCurrentUserAccount(request), allowStart);
			int pageno = EncCommonHelper.getCurrentPageIndex(request, total,
					perPageNum);
			int startIndex = (pageno - 1) * perPageNum;
			List list = this.businessBillDao.getListForReorder(
					Long.parseLong(clientId), searchKey,
					EncCommonHelper.getCurrentUserAccount(request), allowStart,
					startIndex, perPageNum);
			mv.addObject("qr", EncCommonHelper.parseQueryResult(list, total,
					perPageNum, pageno));
			mv.addObject("searchKey", searchKey);
			mv.addObject("clientId", clientId);
			return mv;
		}
	}

	public ModelAndView handleListForCancel(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_CANC")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForCancelView);
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleListForCancel(request, this.dataSource);
			QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
					b.getPageSize(), b.getQParas(), b.getOParas(),
					(String[]) null, b.getShortNameMap(), b.getRetObjs(),
					(String[]) null);
			mv.addAllObjects(b.getParameters());
			mv.addObject("qr", qr);
			mv.addObject("departmentList", this.departmentDao.getList(true));
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, ub));
			return mv;
		}
	}

	public ModelAndView handleInfoForCancel(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.infoForCancelView);
		String id = request.getParameter("id");
		List wcList = this.workCenterDao.getList(false);
		List depList = this.departmentDao.getList(false);
		List tsList = this.tallySetDao.getList(false);
		List payModeList = this.payModeDao.getList(false);
		List baList = this.bankAccountDao.getList("", "");
		List mtList = this.makeTypeDao.getList(false);
		mv.addObject("record", this.getBusinessBill(Long.parseLong(id), true,
				false, false, "", 0L, "", "", false, mtList, baList,
				payModeList, depList, tsList, (List) null, (List) null));
		mv.addObject("workCenterList", wcList);
		return mv;
	}

	public ModelAndView handleListForComplete(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_COMP")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForCompleteView);
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleListForComplete(request, this.dataSource);
			QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
					b.getPageSize(), b.getQParas(), b.getOParas(),
					b.getGParas(), b.getShortNameMap(), b.getRetObjs(),
					(String[]) null);
			mv.addAllObjects(b.getParameters());
			List list = qr.getList();
			ArrayList arr = new ArrayList();

			for (int ub = 0; ub < list.size(); ++ub) {
				Object[] ent = (Object[]) list.get(ub);
				Object[] objs = new Object[6];
				BusinessBill bill = (BusinessBill) this.businessBillItemDao
						.get(BusinessBill.class,
								Long.parseLong(ent[0].toString()));
				objs[0] = bill;
				objs[1] = ent[1];
				objs[2] = ent[2];
				objs[3] = ent[3];
				objs[4] = ent[4];
				objs[5] = ent[5];
				if (bill != null) {
					String linkman = bill.getLinkman();
					if (linkman != null && !linkman.equals("")) {
						objs[1] = objs[1] + "(" + linkman + ")";
					}
				}

				arr.add(objs);
			}

			qr.setList(arr);
			mv.addObject("qr", qr);
			UserBean arg12 = EncCommonHelper.getCurrentUserAccount(request);
			EnterpriseInfo arg13 = EncCommonHelper.getEnterpriseInfo(request);
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, arg12));
			mv.addObject("wcList", PageHelper.getWorkCenterList(
					this.workCenterDao, arg12, arg13));
			mv.addObject("workCenterList", this.workCenterDao.getList(false));
			return mv;
		}
	}

	public ModelAndView handleInfoForComplete(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.infoForCompleteView);
		String id = request.getParameter("id");
		String wcId = request.getParameter("wc_id");
		List depList = this.departmentDao.getList(false);
		List tsList = this.tallySetDao.getList(false);
		List payModeList = this.payModeDao.getList(false);
		List baList = this.bankAccountDao.getList("", "");
		List mtList = this.makeTypeDao.getList(false);
		mv.addObject("record", this.getBusinessBill(Long.parseLong(id), true,
				false, false, "DESIGN", Long.parseLong(wcId), "", "N", false,
				mtList, baList, payModeList, depList, tsList, (List) null,
				(List) null));
		mv.addObject("wc", this.businessBillDao.get(WorkCenter.class,
				Long.parseLong(wcId)));
		mv.addObject("wcId", wcId);
		return mv;
	}

	public ModelAndView handleInfoForLabel(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.infoForLabelView);
		String id = request.getParameter("id");
		String wcId = request.getParameter("wc_id");
		List depList = this.departmentDao.getList(false);
		List tsList = this.tallySetDao.getList(false);
		List payModeList = this.payModeDao.getList(false);
		List baList = this.bankAccountDao.getList("", "");
		List mtList = this.makeTypeDao.getList(false);
		mv.addObject("record", this.getBusinessBill(Long.parseLong(id), false,
				false, false, "DESIGN", Long.parseLong(wcId), "", "N", false,
				mtList, baList, payModeList, depList, tsList, (List) null,
				(List) null));
		mv.addObject("wc", this.businessBillDao.get(WorkCenter.class,
				Long.parseLong(wcId)));
		mv.addObject("wcId", wcId);
		return mv;
	}

	public ModelAndView handleListForReceive(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_UN_RECE")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForReceiveView);
			String startDateStr = "";
			String endDateStr = "";
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			Date startDate = null;
			Date endDate = null;
			long managerId = 0L;
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				managerId = ub.getStaffer().getId();
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			String searchType = request.getParameter("search_type");
			String estName = "";
			String contCode = "";
			String pm = "0";
			String area = "0";
			String estType = "0";
			String estLevel = "0";
			String tsId = "0";
			String billCode = "";
			String content = "";
			String linkman = "";
			String timeouted = "";
			String mngName = "";
			String follName = "";
			String minCost = "";
			String maxCost = "";
			String status = "";
			int total = 0;
			mv.addObject("status", request.getParameter("status"));
			mv.addObject("timeouted", request.getParameter("timeouted"));
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("estName", request.getParameter("est_name"));
			mv.addObject("contCode", request.getParameter("cont_code"));
			mv.addObject("pm", request.getParameter("pm"));
			mv.addObject("area", request.getParameter("area"));
			mv.addObject("estType", request.getParameter("est_type"));
			mv.addObject("estLevel", request.getParameter("est_level"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			mv.addObject("billCode", request.getParameter("bill_code"));
			mv.addObject("content", request.getParameter("content"));
			mv.addObject("minCost", request.getParameter("min_cost"));
			mv.addObject("maxCost", request.getParameter("max_cost"));
			mv.addObject("linkman", request.getParameter("linkman"));
			mv.addObject("mngName", request.getParameter("mng_name"));
			mv.addObject("follName", request.getParameter("foll_name"));
			List cList;
			String contentType;
			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					status = request.getParameter("status");
					startDate = allowStart;
					cList = this.businessBillDao.getListForReceiveCount("",
							allowStart, (Date) null, "", 0L, 0L, 0L, 0L, "",
							"", "", "", "", "", "", "", status, managerId, 0L,
							ub);
				} else {
					String costTotal = request.getParameter("cb_order_date");
					String collectTotal = request.getParameter("cb_est");
					String adjustTotal = request.getParameter("cb_pm");
					contentType = request.getParameter("cb_area");
					String perPageNum = request.getParameter("cb_est_type");
					String pageno = request.getParameter("cb_est_level");
					String startIndex = request.getParameter("cb_cont_code");
					String list = request.getParameter("cb_cost");
					String cbTs = request.getParameter("cb_ts");
					String cbBillCode = request.getParameter("cb_bill_code");
					String cbContent = request.getParameter("cb_content");
					String cbTimeout = request.getParameter("cb_timeout");
					String cbStatus = request.getParameter("cb_status");
					String cbLinkman = request.getParameter("cb_linkman");
					String cbMng = request.getParameter("cb_mng");
					String cbFoll = request.getParameter("cb_foll");
					if (costTotal != null && costTotal.equals("1")) {
						startDateStr = request.getParameter("start_date");
						endDateStr = request.getParameter("end_date");
						startDate = sf.parse(startDateStr);
						if (allowStart != null && allowStart.after(startDate)) {
							startDate = allowStart;
						}

						endDate = sf.parse(EncCommonHelper.getNextDateStr(
								endDateStr, "yyyy-MM-dd"));
						mv.addObject("cbOrderDate", costTotal);
					} else {
						startDate = allowStart;
					}

					if (collectTotal != null && collectTotal.equals("1")) {
						estName = request.getParameter("est_name");
						mv.addObject("cbEst", collectTotal);
					}

					if (startIndex != null && startIndex.equals("1")) {
						contCode = request.getParameter("cont_code");
						mv.addObject("cbContCode", startIndex);
					}

					if (adjustTotal != null && adjustTotal.equals("1")) {
						pm = request.getParameter("pm");
						mv.addObject("cbPm", adjustTotal);
					}

					if (contentType != null && contentType.equals("1")) {
						area = request.getParameter("area");
						mv.addObject("cbArea", contentType);
					}

					if (perPageNum != null && perPageNum.equals("1")) {
						estType = request.getParameter("est_type");
						mv.addObject("cbEstType", perPageNum);
					}

					if (pageno != null && pageno.equals("1")) {
						estLevel = request.getParameter("est_level");
						mv.addObject("cbEstLevel", pageno);
					}

					if (cbTs != null && cbTs.equals("1")) {
						tsId = request.getParameter("ts_id");
						mv.addObject("cbTs", cbTs);
					}

					if (cbBillCode != null && cbBillCode.equals("1")) {
						billCode = request.getParameter("bill_code");
						mv.addObject("cbBillCode", cbBillCode);
					}

					if (cbContent != null && cbContent.equals("1")) {
						content = request.getParameter("content");
						mv.addObject("cbContent", cbContent);
					}

					if (cbTimeout != null && cbTimeout.equals("1")) {
						timeouted = request.getParameter("timeouted");
						mv.addObject("cbTimeout", cbTimeout);
					}

					if (cbStatus != null && cbStatus.equals("1")) {
						status = request.getParameter("status");
						mv.addObject("cbStatus", cbStatus);
					}

					if (list != null && list.equals("1")) {
						minCost = request.getParameter("min_cost");
						maxCost = request.getParameter("max_cost");
						mv.addObject("cbCost", list);
					}

					if (cbLinkman != null && cbLinkman.equals("1")) {
						linkman = request.getParameter("linkman");
						mv.addObject("cbLinkman", cbLinkman);
					}

					if (cbMng != null && cbMng.equals("1")) {
						mngName = request.getParameter("mng_name");
						mv.addObject("cbMng", cbMng);
					}

					if (cbFoll != null && cbFoll.equals("1")) {
						follName = request.getParameter("foll_name");
						mv.addObject("cbFoll", cbFoll);
					}

					cList = this.businessBillDao.getListForReceiveCount(
							estName, startDate, endDate, contCode,
							Long.parseLong(pm), Long.parseLong(area),
							Long.parseLong(estType), Long.parseLong(estLevel),
							billCode, content, linkman, mngName, follName,
							timeouted, minCost, maxCost, status, managerId,
							Long.parseLong(tsId), ub);
				}
			} else {
				searchType = "1";
				startDate = allowStart;
				tsId = String.valueOf(ub.getUser().getDfTsId());
				mv.addObject("tsId", tsId);
				mv.addObject("cbTs", "1");
				cList = this.businessBillDao.getListForReceiveCount("",
						allowStart, (Date) null, "", 0L, 0L, 0L, 0L, "", "",
						"", "", "", "", "", "", status, managerId,
						Long.parseLong(tsId), ub);
			}

			mv.addObject("searchType", searchType);
			BigDecimal costTotal1 = new BigDecimal(0);
			BigDecimal collectTotal1 = new BigDecimal(0);
			BigDecimal adjustTotal1 = new BigDecimal(0);
			if (!cList.isEmpty()) {
				Object[] contentType1 = (Object[]) cList.get(0);
				if (contentType1[0] != null) {
					total = Integer.parseInt(contentType1[0].toString());
				}

				if (contentType1[1] != null) {
					costTotal1 = new BigDecimal(contentType1[1].toString());
				}

				if (contentType1[2] != null) {
					collectTotal1 = new BigDecimal(contentType1[2].toString());
				}

				if (contentType1[3] != null) {
					adjustTotal1 = new BigDecimal(contentType1[3].toString());
				}
			}

			contentType = request.getParameter("content_type");
			if (contentType != null && contentType.equals("EXCEL")) {
				HashMap perPageNum2 = new HashMap();
				List pageno2 = this.businessBillDao.getListForReceive(estName,
						startDate, endDate, contCode, Long.parseLong(pm),
						Long.parseLong(area), Long.parseLong(estType),
						Long.parseLong(estLevel), billCode, content, linkman,
						mngName, follName, timeouted, minCost, maxCost, status,
						managerId, Long.parseLong(tsId), ub, 0, total);
				perPageNum2.put("list", pageno2);
				perPageNum2.put("pmList", this.payModeDao.getList(false));
				perPageNum2.put("remainTotal", costTotal1.add(adjustTotal1)
						.subtract(collectTotal1));
				BusinessBillListForReceiveExcelView startIndex2 = new BusinessBillListForReceiveExcelView();
				return new ModelAndView(startIndex2, perPageNum2);
			} else {
				int perPageNum1 = EncCommonHelper.getPageSize(request);
				int pageno1 = EncCommonHelper.getCurrentPageIndex(request,
						total, perPageNum1);
				int startIndex1 = (pageno1 - 1) * perPageNum1;
				List list1 = this.businessBillDao.getListForReceive(estName,
						startDate, endDate, contCode, Long.parseLong(pm),
						Long.parseLong(area), Long.parseLong(estType),
						Long.parseLong(estLevel), billCode, content, linkman,
						mngName, follName, timeouted, minCost, maxCost, status,
						managerId, Long.parseLong(tsId), ub, startIndex1,
						perPageNum1);
				mv.addObject("qr", EncCommonHelper.parseQueryResult(list1,
						total, perPageNum1, pageno1));
				mv.addObject("areaList", this.areaDao.getList(true));
				mv.addObject("pmList", this.payModeDao.getList(false));
				mv.addObject("estTypeList",
						this.establishmentTypeDao.getList(true));
				mv.addObject("estLevelList",
						this.establishmentLevelDao.getList(true));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				mv.addObject("remainTotal", costTotal1.add(adjustTotal1)
						.subtract(collectTotal1));
				mv.addObject("printId", request.getParameter("print_id"));
				mv.addObject("printBill", request.getParameter("print_bill"));
				mv.addObject("printDetail",
						request.getParameter("print_detail"));
				return mv;
			}
		}
	}

	public ModelAndView handleListForMake(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_MAKE")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForMakeView);
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleListForMake(request, this.dataSource);
			String[] retObjs = new String[]{"i.priceType", "i.lengType",
					"sum(i.squareNum)", "sum(i.amount)"};
			List list = this.queryDao.doQuery(b.getQParas(),
					(OrderParameterCarrier[]) null,
					new String[]{"i.priceType", "i.lengType"},
					b.getShortNameMap(), retObjs, (String[]) null).getList();
			BigDecimal squareTotal = new BigDecimal(0);
			BigDecimal lengMTotal = new BigDecimal(0);
			BigDecimal lengCmTotal = new BigDecimal(0);
			BigDecimal amountTotal = new BigDecimal(0);

			for (int qr = 0; qr < list.size(); ++qr) {
				Object[] arr = (Object[]) list.get(qr);
				if (arr[0] != null) {
					if (arr[0].toString().equals("AREA")) {
						squareTotal = squareTotal.add((BigDecimal) arr[2]);
					} else if (arr[0].toString().equals("LENGTH")) {
						if (arr[1].toString().equals("M")) {
							lengMTotal = lengMTotal.add((BigDecimal) arr[2]);
						} else {
							lengCmTotal = lengCmTotal.add((BigDecimal) arr[2]);
						}
					} else if (arr[0].toString().equals("AMOUNT")) {
						amountTotal = amountTotal.add((BigDecimal) arr[3]);
					}
				}
			}

			squareTotal = squareTotal.setScale(2, 4);
			lengMTotal = lengMTotal.setScale(2, 4);
			lengCmTotal = lengCmTotal.setScale(2, 4);
			mv.addObject("squareTotal", squareTotal);
			mv.addObject("lengMTotal", lengMTotal);
			mv.addObject("lengCmTotal", lengCmTotal);
			mv.addObject("amountTotal", amountTotal);
			QueryResult arg17 = this.queryDao.doQuery(b.getCurrentPage(),
					b.getPageSize(), b.getQParas(), b.getOParas(),
					b.getGParas(), b.getShortNameMap(), b.getRetObjs(),
					(String[]) null);
			mv.addAllObjects(b.getParameters());
			list = arg17.getList();
			ArrayList arg18 = new ArrayList();

			for (int ub = 0; ub < list.size(); ++ub) {
				Object[] ent = (Object[]) list.get(ub);
				Object[] objs = new Object[7];
				BusinessBill bill = (BusinessBill) this.businessBillItemDao
						.get(BusinessBill.class,
								Long.parseLong(ent[0].toString()));
				objs[0] = bill;
				objs[1] = ent[1];
				objs[2] = ent[2];
				objs[3] = ent[3];
				objs[4] = ent[4];
				objs[5] = ent[5];
				objs[6] = ent[6];
				if (bill != null) {
					String linkman = bill.getLinkman();
					if (linkman != null && !linkman.equals("")) {
						objs[1] = objs[1] + "(" + linkman + ")";
					}
				}

				arg18.add(objs);
			}

			arg17.setList(arg18);
			mv.addObject("qr", arg17);
			UserBean arg19 = EncCommonHelper.getCurrentUserAccount(request);
			EnterpriseInfo arg20 = EncCommonHelper.getEnterpriseInfo(request);
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, arg19));
			mv.addObject("wcList", PageHelper.getWorkCenterList(
					this.workCenterDao, arg19, arg20));
			mv.addObject("workCenterList", this.workCenterDao.getList(false));
			return mv;
		}
	}

	public ModelAndView handleListForOutput(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "OUTP_NEW")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForOutputView);
			String contentType = request.getParameter("content_type");
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleListForOutput(request, this.dataSource);
			QueryResult qr;
			if (contentType != null && contentType.equals("EXCEL")) {
				qr = this.queryDao.doQuery(b.getQParas(), b.getOParas(),
						b.getGParas(), b.getShortNameMap(), b.getRetObjs(),
						(String[]) null);
				HashMap ub1 = new HashMap();
				ub1.put("list", qr.getList());
				ub1.put("wcList", this.workCenterDao.getList(false));
				ub1.put("mtList", this.makeTypeDao.getList(false));
				BusinessBillListForOutputExcelView ent1 = new BusinessBillListForOutputExcelView();
				return new ModelAndView(ent1, ub1);
			} else {
				qr = this.queryDao.doQuery(b.getCurrentPage(), b.getPageSize(),
						b.getQParas(), b.getOParas(), (String[]) null,
						b.getShortNameMap(), b.getRetObjs(), (String[]) null);
				mv.addAllObjects(b.getParameters());
				mv.addObject("qr", qr);
				UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
				EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				mv.addObject("myWcList", PageHelper.getWorkCenterList(
						this.workCenterDao, ub, ent));
				mv.addObject("wcList", this.workCenterDao.getList(false));
				mv.addObject("mtList", this.makeTypeDao.getList(false));
				String cbWc = request.getParameter("cb_wc");
				String searchType = request.getParameter("search_type");
				String wcId = request.getParameter("wc_id");
				if (wcId != null
						&& !wcId.equals("")
						&& !wcId.equals("0")
						&& (cbWc != null && cbWc.equals("1") || searchType != null
								&& searchType.equals("2"))) {
					mv.addObject("processList", this.workProcessDao.getList(
							Long.parseLong(wcId), true));
				}

				return mv;
			}
		}
	}

	public ModelAndView handleListForDeliver(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "DELI_BILL")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForDeliverView);
			String type = request.getParameter("type");
			String orderBy = request.getParameter("order_by");
			String tsId = request.getParameter("ts_id");
			String searchKey = request.getParameter("search_key");
			if (type == null) {
				type = "UN_DELI_COMP";
			}

			String delivered = "";
			String completed = "";
			String timeout = "";
			if (type.equals("UN_DELIVER")) {
				delivered = "N";
			} else if (type.equals("UN_DELI_COMP")) {
				delivered = "N";
				completed = "Y";
			} else if (type.equals("UN_DELI_TIMEOUT")) {
				delivered = "N";
				timeout = "Y";
			} else if (type.equals("UN_DELI_TIMEOUT_UN_COMP")) {
				delivered = "N";
				timeout = "Y";
				completed = "N";
			} else if (type.equals("UN_DELI_TIMEOUT_COMP")) {
				delivered = "N";
				timeout = "Y";
				completed = "Y";
			} else if (type.equals("PART_DELI")) {
				delivered = "P";
			}

			long managerId = 0L;
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				managerId = ub.getStaffer().getId();
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			if (tsId == null || tsId.equals("")) {
				tsId = String.valueOf(ub.getUser().getDfTsId());
			}

			int perPageNum = EncCommonHelper.getPageSize(request);
			int total = this.businessBillDao.getListForDeliverCount(delivered,
					completed, timeout, searchKey, managerId,
					Long.parseLong(tsId), ub, allowStart);
			int pageno = EncCommonHelper.getCurrentPageIndex(request, total,
					perPageNum);
			int startIndex = (pageno - 1) * perPageNum;
			List list = this.businessBillDao.getListForDeliver(delivered,
					completed, timeout, searchKey, managerId,
					Long.parseLong(tsId), ub, allowStart, orderBy, startIndex,
					perPageNum);
			mv.addObject("qr", EncCommonHelper.parseQueryResult(list, total,
					perPageNum, pageno));
			mv.addObject("type", type);
			mv.addObject("tsId", tsId);
			mv.addObject("orderBy", orderBy);
			mv.addObject("searchKey", searchKey);
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, ub));
			mv.addObject("printId", request.getParameter("print_id"));
			mv.addObject("printCost", request.getParameter("print_cost"));
			mv.addObject("printType", request.getParameter("print_type"));
			mv.addObject("needPop", request.getParameter("need_pop"));
			return mv;
		}
	}

	public ModelAndView handleListForSetu(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "SETU_BILL")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForSetuView);
			String type = request.getParameter("type");
			String tsId = request.getParameter("ts_id");
			String searchKey = request.getParameter("search_key");
			long managerId = 0L;
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				managerId = ub.getStaffer().getId();
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			if (tsId == null || tsId.equals("")) {
				tsId = String.valueOf(ub.getUser().getDfTsId());
			}

			int perPageNum = EncCommonHelper.getPageSize(request);
			int total = this.businessBillDao.getListForSetuCount(searchKey,
					type, managerId, Long.parseLong(tsId), ub, allowStart);
			int pageno = EncCommonHelper.getCurrentPageIndex(request, total,
					perPageNum);
			int startIndex = (pageno - 1) * perPageNum;
			List list = this.businessBillDao.getListForSetu(searchKey, type,
					managerId, Long.parseLong(tsId), ub, allowStart,
					startIndex, perPageNum);
			mv.addObject("qr", EncCommonHelper.parseQueryResult(list, total,
					perPageNum, pageno));
			mv.addObject("type", type);
			mv.addObject("tsId", tsId);
			mv.addObject("searchKey", searchKey);
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, ub));
			mv.addObject("printId", request.getParameter("print_id"));
			mv.addObject("printCost", request.getParameter("print_cost"));
			mv.addObject("needPop", request.getParameter("need_pop"));
			return mv;
		}
	}

	public ModelAndView handleListForSelect(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.listForSelectView);
		String searchKey = request.getParameter("search_key");
		String searchType = request.getParameter("search_type");
		String tsId = request.getParameter("ts_id");
		long managerId = 0L;
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
		if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
			managerId = ub.getStaffer().getId();
		}

		if (searchType != null) {
			if (searchType.equals("STO") && ent.getOutBusi().equals("ALL")) {
				tsId = "0";
			} else if (searchType.equals("FEE")
					&& ent.getFeeBusi().equals("ALL")) {
				tsId = "0";
			}
		}

		Date allowStart = null;
		if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
			allowStart = EncCommonHelper.getEarlDataDate(request);
		}

		int perPageNum = EncCommonHelper.getPageSize(request);
		int total;
		if (searchType != null && searchType.equals("STO")) {
			total = this.businessBillDao.getListForStoSelectCount(searchKey,
					Long.parseLong(tsId), ub, managerId, allowStart);
		} else if (searchType != null && searchType.equals("FEE")) {
			total = this.businessBillDao.getListForFeeSelectCount(searchKey,
					Long.parseLong(tsId), ub, managerId, allowStart);
		} else {
			total = this.businessBillDao.getListForOutCostSelectCount(
					searchKey, ub, managerId, allowStart);
		}

		int pageno = EncCommonHelper.getCurrentPageIndex(request, total,
				perPageNum);
		int startIndex = (pageno - 1) * perPageNum;
		List list;
		if (searchType != null && searchType.equals("STO")) {
			list = this.businessBillDao.getListForStoSelect(searchKey,
					Long.parseLong(tsId), ub, managerId, allowStart,
					startIndex, perPageNum);
		} else if (searchType != null && searchType.equals("FEE")) {
			list = this.businessBillDao.getListForFeeSelect(searchKey,
					Long.parseLong(tsId), ub, managerId, allowStart,
					startIndex, perPageNum);
		} else {
			list = this.businessBillDao.getListForOutCostSelect(searchKey, ub,
					managerId, allowStart, startIndex, perPageNum);
		}

		mv.addObject("qr", EncCommonHelper.parseQueryResult(list, total,
				perPageNum, pageno));
		mv.addObject("searchKey", searchKey);
		mv.addObject("searchType", searchType);
		mv.addObject("tsId", tsId);
		return mv;
	}

	public ModelAndView handleGetBusiForRece(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String clientId = request.getParameter("est_id");
		String tsId = request.getParameter("ts_id");
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
		String startDateStr = request.getParameter("start_date");
		String endDateStr = request.getParameter("end_date");
		Date startDate = null;
		Date endDate = null;
		if (startDateStr != null && !startDateStr.equals("")) {
			startDate = sf.parse(startDateStr);
		}

		if (endDateStr != null && !endDateStr.equals("")) {
			endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
					"yyyy-MM-dd"));
		}

		List list = this.businessBillDao.getListForReceive(
				Long.parseLong(clientId), Long.parseLong(tsId), startDate,
				endDate);
		HashMap map = new HashMap();

		try {
			ArrayList mapper = new ArrayList();

			for (int json = 0; json < list.size(); ++json) {
				HashMap out = new HashMap();
				Object[] objs = (Object[]) list.get(json);
				BusinessBill b = (BusinessBill) objs[0];
				BusinessBillExt be = (BusinessBillExt) objs[1];
				out.put("id", Long.valueOf(b.getId()));
				out.put("code", b.getBillCode());
				out.put("date", sf.format(b.getOrderDate()));
				out.put("totaCost", b.getCost());
				out.put("remaCost", b.getCost().add(be.getAdjustCost())
						.subtract(be.getCollectedCost()));
				out.put("cont", b.getContent());
				out.put("linkman", b.getLinkman());
				mapper.add(out);
			}

			map.put("items", mapper);
			map.put("status", "OK");
			map.put("errMsg", "");
		} catch (Exception arg17) {
			map.put("status", "ERROR");
			map.put("errMsg", arg17.toString());
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg18 = new ObjectMapper();
		String arg19 = arg18.writeValueAsString(map);
		ServletOutputStream arg20 = response.getOutputStream();
		arg20.write(arg19.getBytes("utf-8"));
		arg20.flush();
		arg20.close();
		return null;
	}

	public ModelAndView handleByDateForReceive(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.byDateForReceiveView);
		String type = request.getParameter("bill_type");
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
		Date now = new Date();
		String endDate = sf.format(now);
		mv.addObject("billType", type);
		mv.addObject("endDate", endDate);
		return mv;
	}

	private BusinessBillBean getBusinessBill(long id, boolean needAccssories,
			boolean parseImgAcc, boolean parsePathAcc, String accType,
			long wcId, String isCooper, String compFlag, boolean parseMaker,
			List makeTypeList, List baList, List payModeList, List depList,
			List tsList, List wcList, List proList) {
		BusinessBill businessBill = (BusinessBill) this.businessBillDao.get(
				BusinessBill.class, id);
		BusinessBillExt be = (BusinessBillExt) this.businessBillDao.get(
				BusinessBillExt.class, id);
		BusinessBillBean form = new BusinessBillBean();
		form.setBusinessBill(businessBill);
		form.setBusinessBillExt(be);
		List itemList;
		if (wcId == 0L) {
			if (isCooper != null && !isCooper.equals("")) {
				itemList = this.businessBillItemDao.getList(
						businessBill.getId(), isCooper, compFlag);
			} else {
				itemList = this.businessBillItemDao
						.getListWidthExt(businessBill.getId());
			}
		} else {
			itemList = this.businessBillItemDao.getList(businessBill.getId(),
					wcId, compFlag);
		}

		String areaFlag = "N";
		String amountFlag = "N";
		String lengthFlag = "N";
		BigDecimal amount = new BigDecimal(0);
		BigDecimal square = new BigDecimal(0);
		BigDecimal lengM = new BigDecimal(0);
		BigDecimal lengCm = new BigDecimal(0);
		ArrayList arr = new ArrayList();

		for (int sortArr = 0; sortArr < itemList.size(); ++sortArr) {
			Object[] str = (Object[]) itemList.get(sortArr);
			BusinessBillItem i = (BusinessBillItem) str[0];
			BusinessBillItemExt wp = (BusinessBillItemExt) str[1];
			BusinessBillItemBean bean = new BusinessBillItemBean();
			bean.setBusinessBillItem(i);
			bean.setBusinessBillItemExt(wp);
			bean.setMakeTypeName(EncCommonHelper.getSimpleObjectName(
					makeTypeList, i.getMakeTypeId()));
			bean.setUnit(this.getUnit(makeTypeList, i.getMakeTypeId()));
			arr.add(bean);
			if (i.getPriceType().equals("AMOUNT")) {
				amountFlag = "Y";
				amount = amount.add(i.getAmount());
			} else if (i.getPriceType().equals("AREA")) {
				areaFlag = "Y";
				square = square.add(i.getSquareNum());
			} else if (i.getPriceType().equals("LENGTH")) {
				lengthFlag = "Y";
				if (i.getLengType().equals("M")) {
					lengM = lengM.add(i.getSquareNum());
				} else {
					lengCm = lengCm.add(i.getSquareNum());
				}
			}

			form.setMakeTime(wp.getMakeTime());
		}

		businessBill.setAmount(amount);
		businessBill.setSquare(square);
		businessBill.setLengM(lengM);
		businessBill.setLengCm(lengCm);
		ArrayList arg35 = new ArrayList();

		int arg36;
		BusinessBillItemBean arg37;
		for (arg36 = 0; arg36 < arr.size(); ++arg36) {
			arg37 = (BusinessBillItemBean) arr.get(arg36);
			if (arg37.getBusinessBillItem().getPriceType().equals("AREA")) {
				arg35.add(arg37);
			}
		}

		for (arg36 = 0; arg36 < arr.size(); ++arg36) {
			arg37 = (BusinessBillItemBean) arr.get(arg36);
			if (arg37.getBusinessBillItem().getPriceType().equals("LENGTH")) {
				arg35.add(arg37);
			}
		}

		for (arg36 = 0; arg36 < arr.size(); ++arg36) {
			arg37 = (BusinessBillItemBean) arr.get(arg36);
			if (arg37.getBusinessBillItem().getPriceType().equals("AMOUNT")) {
				arg35.add(arg37);
			}
		}

		form.setItems(arg35);
		form.setHasAmountItem(amountFlag);
		form.setHasAreaItem(areaFlag);
		form.setHasLengthItem(lengthFlag);
		if (businessBill != null) {
			Establishment arg38 = (Establishment) this.businessBillDao.get(
					Establishment.class, businessBill.getClientId());
			if (arg38 != null) {
				form.setClientName(arg38.getEstName());
				form.setClientCode(arg38.getEstCode());
				form.setBusiPphone(arg38.getBusiPphone());
				form.setMakePphone(arg38.getMakePphone());
				if (arg38.getEstLevelId() != 0L) {
					EstablishmentLevel arg39 = (EstablishmentLevel) this.businessBillDao
							.get(EstablishmentLevel.class,
									arg38.getEstLevelId());
					if (arg39 != null) {
						form.setClientLevel(arg39.getLevelName());
					}
				}
			}

			form.setBankAccountName(EncCommonHelper.getSimpleObjectName(baList,
					businessBill.getBankAccountId()));
			form.setPayModeName(EncCommonHelper.getSimpleObjectName(
					payModeList, businessBill.getPayModeId()));
			form.setDepartmentName(EncCommonHelper.getSimpleObjectName(depList,
					businessBill.getDepartmentId()));
			form.setTallySetName(EncCommonHelper.getSimpleObjectName(tsList,
					businessBill.getTallySetId()));
		}

		if (needAccssories) {
			String[] arg41 = (String[]) null;
			if (accType != null && !accType.equals("")) {
				arg41 = new String[]{accType};
			}

			List arg42 = this.accessoryDao.getList("BUSINESS_BILL", id, arg41,
					wcId);
			form.setAccessories(arg42);
			if (parseImgAcc) {
				form.setImgAccs(this.parseImgAcc(arg42));
			}

			if (parsePathAcc) {
				form.setPathAccs(this.parsePathAcc(arg42));
			}
		}

		if (parseMaker) {
			String arg44 = "";

			for (int arg43 = 0; arg43 < proList.size(); ++arg43) {
				WorkProcess arg40 = (WorkProcess) proList.get(arg43);
				if (arg40.getWorkCenterId() == wcId) {
					arg44 = arg44 + arg40.getProcessName()
							+ "：<span style=\'width:120px\'></span>";
				}
			}

			arg44 = EncCommonHelper.getSimpleObjectName(wcList, wcId) + "."
					+ arg44;
			form.setMakerStr(arg44);
		}

		return form;
	}

	private String getUnit(List<?> makeTypeList, long makeTypeId) {
		String unit = "";
		if (makeTypeId != 0L) {
			for (int j = 0; j < makeTypeList.size(); ++j) {
				MakeType p = (MakeType) makeTypeList.get(j);
				if (p.getId() == makeTypeId) {
					unit = p.getUnit();
					break;
				}
			}
		}

		return unit;
	}

	private List<?> parseImgAcc(List<?> accList) {
		ArrayList arr = new ArrayList();

		for (int i = 0; i < accList.size(); ++i) {
			Accessory acc = (Accessory) accList.get(i);
			if (acc.getFileName() != null && !acc.getFileName().equals("")) {
				String fileName = acc.getFileName().toLowerCase();
				if (fileName.endsWith(".jpg") || fileName.endsWith(".jpeg")
						|| fileName.endsWith(".gif")
						|| fileName.endsWith(".png")
						|| fileName.endsWith(".bmp")) {
					arr.add(acc);
				}
			}
		}

		return arr;
	}

	private List<?> parsePathAcc(List<?> accList) {
		ArrayList arr = new ArrayList();

		for (int i = 0; i < accList.size(); ++i) {
			Accessory acc = (Accessory) accList.get(i);
			if (acc.getFileName() == null || acc.getFileName().equals("")) {
				arr.add(acc);
			}
		}

		return arr;
	}

	public ModelAndView handleExamine(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		String flag = request.getParameter("flag");
		String msg = "";
		boolean num = false;
		long examinerId = ub.getStaffer().getId();
		String examinerName = ub.getStaffer().getStafferName();
		byte arg28;
		if (flag.equals("UNEXA")) {
			if (!EncCommonHelper.checkPrivilege(request, "BUSI_UN_EXAM")) {
				throw new Exception("Permission deny!");
			}

			String noExamOthe = request.getParameter("bill_id");

			try {
				String[] saBusClie = noExamOthe.split(";");

				for (int customTxt = 0; customTxt < saBusClie.length; ++customTxt) {
					this.businessBillService.txUnExamine(
							Long.parseLong(saBusClie[customTxt]),
							this.businessBillItemDao,
							this.bankAccountBalanceDao,
							this.bankAccountDetailDao, this.financeDetailDao,
							this.idGenerator, ub);
				}

				msg = "反审核成功！";
			} catch (NotAllowException arg26) {
				msg = arg26.getMessage();
			} catch (CannotAcquireLockException arg27) {
				msg = "事务冲突故障，请重新操作！";
			}

			arg28 = 1;
		} else {
			if (!EncCommonHelper.checkPrivilege(request, "BUSI_EXAM")) {
				throw new Exception("Permission deny!");
			}

			boolean arg29 = false;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EXAM_OTHE")) {
				arg29 = true;
			}

			boolean arg30 = false;
			String arg31 = "";
			EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
			SmsAlert sa = this.smsAlertDao.get("BUS_CLIE");
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				arg30 = true;
				arg31 = sa.getCustomTxt();
			}

			try {
				String w;
				if (flag.equals("SINGLE_EXA")) {
					w = request.getParameter("bill_id");
					String arg32 = request.getParameter("wc_id_str");
					String arg33 = request.getParameter("cooper_str");
					String arg34 = request.getParameter("acc_wc_id_str");
					String me = request.getParameter("acc_type_str");
					Map map1 = this.businessBillService.txSingleExamine(
							Long.parseLong(w), arg29, arg32, arg33, arg34, me,
							this.businessBillDao, this.businessBillItemDao,
							this.accessoryDao, this.receiveBillDao,
							this.adjustBillDao, examinerId, examinerName,
							this.bankAccountBalanceDao, this.cooperBillItemDao,
							this.feeBillDao, this.stockDao, this.outputDao,
							this.idGenerator);
					if (map1.get("exam") != null) {
						try {
							if (arg30) {
								PageHelper.sendBusClieSms(map1, arg31,
										ent.getShortName(), this.stafferDao,
										this.idGenerator);
							}
						} catch (Exception arg23) {
							arg23.printStackTrace();
						}
					}
				} else if (flag.equals("MULTI_EXA")) {
					w = request.getParameter("id_str");
					String[] arr = w.split(";");

					for (int i = 0; i < arr.length; ++i) {
						Map map = this.businessBillService.txExamine(
								Long.parseLong(arr[i]), arg29,
								this.businessBillDao, this.businessBillItemDao,
								this.receiveBillDao, this.adjustBillDao,
								examinerId, examinerName,
								this.bankAccountBalanceDao,
								this.cooperBillItemDao, this.feeBillDao,
								this.stockDao, this.idGenerator);
						if (map.get("exam") != null) {
							try {
								if (arg30) {
									PageHelper.sendBusClieSms(map, arg31,
											ent.getShortName(),
											this.stafferDao, this.idGenerator);
								}
							} catch (Exception arg22) {
								arg22.printStackTrace();
							}
						}
					}
				}

				msg = "审核成功";
			} catch (NotAllowException arg24) {
				msg = arg24.getMessage();
			} catch (CannotAcquireLockException arg25) {
				msg = "事务冲突故障，请重新操作！";
			}

			arg28 = 1;
		}

		mv.addObject("returnValue", String.valueOf(arg28));
		EncCommonHelper.setAlertMessage(request, msg);
		return mv;
	}

	public ModelAndView handleCancel(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_CANC")) {
			throw new Exception("Permission deny!");
		} else {
			String[] idArr = request.getParameter("id").split(";");
			String reason = request.getParameter("reason");
			String filePath = this.getServletContext().getRealPath("/");
			String msg = "";

			try {
				for (int w = 0; w < idArr.length; ++w) {
					msg = this.businessBillService.txCancel(
							Long.parseLong(idArr[w]), reason,
							this.businessBillDao, ub,
							this.bankAccountBalanceDao,
							this.bankAccountDetailDao, this.financeDetailDao,
							this.accessoryDao, filePath, this.idGenerator);
				}
			} catch (NotAllowException arg9) {
				msg = arg9.getMessage();
			} catch (CannotAcquireLockException arg10) {
				msg = "事务冲突故障，请重新操作！";
			}

			mv.addObject("returnValue", "ok");
			EncCommonHelper.setAlertMessage(request, msg);
			return mv;
		}
	}

	public ModelAndView handleComplete(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_COMP")) {
			throw new Exception("Permission deny!");
		} else {
			String itemIdStr = request.getParameter("item_id_str");
			String billId = request.getParameter("bill_id");
			String wcId = request.getParameter("wc_id");
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
			List wcList = this.workCenterDao.getList(false);
			List proList = this.workProcessDao.getList(Long.parseLong(wcId),
					true);
			CodeRule obCr = this.codeRuleDao.get("OUT_BILL");
			long proId = 0L;
			if (proList.size() > 0) {
				proId = ((WorkProcess) proList.get(0)).getId();
			}

			List mtList = this.makeTypeDao.getList(false);
			String customTxt = "";
			boolean noCompOthe = false;
			boolean saFolComp = false;
			boolean saBusComp = false;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_COMP_OTHE")) {
				noCompOthe = true;
			}

			SmsAlert sa = this.smsAlertDao.get("BUS_COMPLETE");
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				saBusComp = true;
				customTxt = sa.getCustomTxt();
			}

			sa = this.smsAlertDao.get("FOL_COMP");
			Object saFolRecList = new ArrayList();
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				saFolComp = true;
				saFolRecList = this.smsAlertDao.getReceiverList(sa.getId());
			}

			String msg;
			try {
				Map w = this.businessBillService.txWcComplete(
						Long.parseLong(billId), Long.parseLong(wcId), proId,
						itemIdStr, obCr, wcList, mtList, ub, noCompOthe,
						this.businessBillDao, this.businessBillItemDao,
						this.outBillDao, this.stockDao, this.stockBalanceDao,
						this.serialNumberDao, this.idGenerator);
				if (w.get("comp") != null) {
					try {
						if (saFolComp) {
							PageHelper.sendFolCompMsg(w, ub,
									(List) saFolRecList, this.stafferDao,
									this.idGenerator);
						}
					} catch (Exception arg24) {
						arg24.printStackTrace();
					}

					try {
						if (saBusComp) {
							PageHelper.sendBusCompSms(w, customTxt,
									ent.getShortName(), this.stafferDao,
									this.idGenerator);
						}
					} catch (Exception arg23) {
						arg23.printStackTrace();
					}
				}

				msg = "保存成功！";
			} catch (NotAllowException arg25) {
				msg = arg25.getMessage();
			} catch (StockNoEnoughException arg26) {
				msg = arg26.getMessage();
			} catch (CannotAcquireLockException arg27) {
				msg = "事务冲突故障，请重新操作！";
			}

			mv.addObject("returnValue", billId);
			EncCommonHelper.setAlertMessage(request, msg);
			return mv;
		}
	}

	public ModelAndView handleCompleteBatch(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_COMP")) {
			throw new Exception("Permission deny!");
		} else {
			String idStr = request.getParameter("id_str");
			String wcIdStr = request.getParameter("wc_id_str");
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
			List wcList = this.workCenterDao.getList(false);
			CodeRule obCr = this.codeRuleDao.get("OUT_BILL");
			List proList = this.workProcessDao.getList(0L, true);
			List mtList = this.makeTypeDao.getList(false);
			String customTxt = "";
			boolean noCompOthe = false;
			boolean saFolComp = false;
			boolean saBusComp = false;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_COMP_OTHE")) {
				noCompOthe = true;
			}

			SmsAlert sa = this.smsAlertDao.get("BUS_COMPLETE");
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				saBusComp = true;
				customTxt = sa.getCustomTxt();
			}

			sa = this.smsAlertDao.get("FOL_COMP");
			Object saFolRecList = new ArrayList();
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				saFolComp = true;
				saFolRecList = this.smsAlertDao.getReceiverList(sa.getId());
			}

			String msg = "";
			if (idStr != null && !idStr.equals("")) {
				String[] idArr = idStr.split(";");
				String[] wcIdArr = wcIdStr.split(";");

				for (int i = 0; i < idArr.length; ++i) {
					long proId = 0L;
					long wcId = Long.parseLong(wcIdArr[i]);

					for (int w = 0; w < proList.size(); ++w) {
						WorkProcess me = (WorkProcess) proList.get(w);
						if (me.getWorkCenterId() == wcId) {
							proId = me.getId();
							break;
						}
					}

					try {
						Map arg32 = this.businessBillService.txWcComplete(
								Long.parseLong(idArr[i]), wcId, proId,
								(String) null, obCr, wcList, mtList, ub,
								noCompOthe, this.businessBillDao,
								this.businessBillItemDao, this.outBillDao,
								this.stockDao, this.stockBalanceDao,
								this.serialNumberDao, this.idGenerator);
						if (arg32.get("comp") != null) {
							try {
								if (saFolComp) {
									PageHelper.sendFolCompMsg(arg32, ub,
											(List) saFolRecList,
											this.stafferDao, this.idGenerator);
								}
							} catch (Exception arg28) {
								arg28.printStackTrace();
							}

							try {
								if (saBusComp) {
									PageHelper.sendBusCompSms(arg32, customTxt,
											ent.getShortName(),
											this.stafferDao, this.idGenerator);
								}
							} catch (Exception arg27) {
								arg27.printStackTrace();
							}
						}

						msg = "保存成功！";
					} catch (NotAllowException arg29) {
						msg = arg29.getMessage();
					} catch (StockNoEnoughException arg30) {
						msg = arg30.getMessage();
					} catch (CannotAcquireLockException arg31) {
						msg = "事务冲突故障，只完成部分单据的完工操作，未完成的单据请重新操作！";
						break;
					}
				}

				mv.addObject("returnValue", String.valueOf(idArr.length));
				EncCommonHelper.setAlertMessage(request, msg);
			}

			return mv;
		}
	}

	public ModelAndView handleSearchResult(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_BILL_SEAR")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.searchResultView);
			String contentType = request.getParameter("content_type");
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleSearchResult(request, this.dataSource);
			String[] countObjs = new String[]{"sum(b.cost)", "sum(b.imprest)",
					"sum(be.collectedCost)", "sum(be.adjustCost)",
					"sum(b.favCost)", "sum(b.square)", "sum(b.lengM)",
					"sum(b.lengCm)"};
			QueryResult qr;
			if (contentType != null && contentType.equals("EXCEL")) {
				qr = this.queryDao.doQuery(b.getQParas(), b.getOParas(),
						(String[]) null, b.getShortNameMap(), b.getRetObjs(),
						countObjs);
			} else {
				qr = this.queryDao.doQuery(b.getCurrentPage(), b.getPageSize(),
						b.getQParas(), b.getOParas(), (String[]) null,
						b.getShortNameMap(), b.getRetObjs(), countObjs);
			}

			Object[] objs = qr.getExtCount();
			BigDecimal percent = null;
			if (objs[0] != null && objs[2] != null && objs[3] != null) {
				BigDecimal ub = (new BigDecimal(objs[0].toString()))
						.add(new BigDecimal(objs[3].toString()));
				if (ub.compareTo(new BigDecimal(0)) == 0) {
					percent = new BigDecimal(100);
				} else {
					percent = (new BigDecimal(objs[2].toString())).multiply(
							new BigDecimal(100)).divide(ub, 2, 4);
				}
			}

			if (contentType != null && contentType.equals("EXCEL")) {
				HashMap ub2 = new HashMap();
				ub2.put("list", qr.getList());
				ub2.put("costTotal", objs[0]);
				ub2.put("imprestTotal", objs[1]);
				ub2.put("collectTotal", objs[2]);
				ub2.put("adjustTotal", objs[3]);
				ub2.put("favTotal", objs[4]);
				ub2.put("squareTotal", objs[5]);
				ub2.put("lengMTotal", objs[6]);
				ub2.put("lengCmTotal", objs[7]);
				ub2.put("percent", percent);
				BusinessBillListExcelView v = new BusinessBillListExcelView();
				return new ModelAndView(v, ub2);
			} else {
				mv.addAllObjects(b.getParameters());
				mv.addObject("qr", qr);
				mv.addObject("costTotal", objs[0]);
				mv.addObject("imprestTotal", objs[1]);
				mv.addObject("collectTotal", objs[2]);
				mv.addObject("adjustTotal", objs[3]);
				mv.addObject("favTotal", objs[4]);
				mv.addObject("squareTotal", objs[5]);
				mv.addObject("lengMTotal", objs[6]);
				mv.addObject("lengCmTotal", objs[7]);
				mv.addObject("percent", percent);
				mv.addObject("departmentList", this.departmentDao.getList(true));
				UserBean ub1 = EncCommonHelper.getCurrentUserAccount(request);
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub1));
				mv.addObject("printId", request.getParameter("print_id"));
				mv.addObject("printBill", request.getParameter("print_bill"));
				mv.addObject("printDetail",
						request.getParameter("print_detail"));
				return mv;
			}
		}
	}

	public ModelAndView handlePrint(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String id = request.getParameter("id");
		String type = request.getParameter("type");
		String contentType = request.getParameter("content_type");
		EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
		List depList = this.departmentDao.getList(false);
		List tsList = this.tallySetDao.getList(false);
		List payModeList = this.payModeDao.getList(false);
		List baList = this.bankAccountDao.getList("", "");
		List mtList = this.makeTypeDao.getList(false);
		List wcList = this.workCenterDao.getList(false);
		if (contentType != null && contentType.equals("EXCEL")) {
			HashMap arg32 = new HashMap();
			arg32.put("record", this.getBusinessBill(Long.parseLong(id), false,
					false, false, "", 0L, "", "", false, mtList, baList,
					payModeList, depList, tsList, (List) null, (List) null));
			arg32.put("wcList", wcList);
			BusinessBillExcelView arg28 = new BusinessBillExcelView();
			return new ModelAndView(arg28, arg32);
		} else {
			if (type != null
					&& (type.equals("ITEM") || type.equals("ITEM_SIMPLE"))) {
				BusinessBillItem needAccssories = (BusinessBillItem) this.businessBillItemDao
						.get(BusinessBillItem.class, Long.parseLong(id));
				if (needAccssories == null) {
					return null;
				}

				id = String.valueOf(needAccssories.getBillId());
				if (type.equals("ITEM")
						&& EncCommonHelper.checkPrivilege(request, "BUSI_BILL")
						&& !EncCommonHelper.checkPurePrivilege(request,
								"NO_BUSI_COST")) {
					type = "";
				} else {
					type = "SIMPLE";
				}
			}

			ModelAndView mv;
			boolean arg20;
			if (type != null && type.equals("SIMPLE")) {
				arg20 = false;
				if (ent.getMbPrintImage() != null
						&& ent.getMbPrintImage().equals("Y")) {
					arg20 = true;
				}

				mv = new ModelAndView(this.printSimpleView);
				mv.addObject("record", this.getBusinessBill(Long.parseLong(id),
						true, arg20, true, "", 0L, "", "", false, mtList,
						baList, payModeList, depList, tsList, (List) null,
						(List) null));
				mv.addObject("codeRule", this.codeRuleDao.get("MAKE_BILL"));
			} else if (type != null && type.equals("MAKE")) {
				arg20 = false;
				if (ent.getMbPrintImage() != null
						&& ent.getMbPrintImage().equals("Y")) {
					arg20 = true;
				}

				mv = new ModelAndView(this.printMakeView);
				String[] arg27 = id.split(";");
				String arg25 = request.getParameter("wc_id");
				String[] arg30 = arg25.split(";");
				ArrayList arg33 = new ArrayList();
				List proList = this.workProcessDao.getList(0L, true);

				for (int i1 = 0; i1 < arg27.length; ++i1) {
					arg33.add(this.getBusinessBill(Long.parseLong(arg27[i1]),
							true, arg20, true, "DESIGN",
							Long.parseLong(arg30[i1]), "", "N", true, mtList,
							baList, payModeList, depList, tsList, wcList,
							proList));
				}

				mv.addObject("list", arg33);
				mv.addObject("codeRule", this.codeRuleDao.get("MAKE_BILL"));
			} else if (type != null && type.equals("COOPER")) {
				arg20 = false;
				if (ent.getMbPrintImage() != null
						&& ent.getMbPrintImage().equals("Y")) {
					arg20 = true;
				}

				mv = new ModelAndView(this.printMakeView);
				ArrayList arg26 = new ArrayList();
				arg26.add(this.getBusinessBill(Long.parseLong(id), true, arg20,
						true, "COOPER", 0L, "Y", "N", false, mtList, baList,
						payModeList, depList, tsList, (List) null, (List) null));
				mv.addObject("list", arg26);
				mv.addObject("codeRule", this.codeRuleDao.get("MAKE_BILL"));
				mv.addObject("type", type);
			} else if (type != null && type.equals("LITTLE")) {
				mv = new ModelAndView(this.printLittleView);
				mv.addObject("record", this.getBusinessBill(Long.parseLong(id),
						false, false, false, "", 0L, "", "", false, mtList,
						baList, payModeList, depList, tsList, (List) null,
						(List) null));
			} else if (type != null && type.equals("LABEL")) {
				String arg21 = request.getParameter("item_id_str");
				if (arg21 != null && !arg21.equals("")) {
					BusinessBillBean arg23 = this.getBusinessBill(
							Long.parseLong(id), false, false, false, "", 0L,
							"", "", false, mtList, baList, payModeList,
							depList, tsList, (List) null, (List) null);
					mv = new ModelAndView(this.printLabelView);
					arg21 = ";" + arg21 + ";";
					ArrayList arg24 = new ArrayList();

					for (int arg29 = 0; arg29 < arg23.getItems().size(); ++arg29) {
						BusinessBillItemBean arg31 = (BusinessBillItemBean) arg23
								.getItems().get(arg29);
						if (arg21.indexOf(";"
								+ arg31.getBusinessBillItem().getId() + ";") != -1) {
							arg24.add(arg31);
						}
					}

					arg23.setItems(arg24);
					mv.addObject("record", arg23);
					mv.addObject("itemIdStr",
							request.getParameter("item_id_str"));
				} else {
					mv = new ModelAndView(this.printPackageView);
					BusinessBill arg22 = (BusinessBill) this.businessBillDao
							.get(BusinessBill.class, Long.parseLong(id));
					mv.addObject("record", arg22);
					mv.addObject(
							"est",
							this.businessBillDao.get(Establishment.class,
									arg22.getClientId()));
				}

				mv.addObject("now", new Date());
			} else if (type != null && type.equals("RECE")) {
				mv = new ModelAndView(this.printReceView);
				mv.addObject("record", this.getBusinessBill(Long.parseLong(id),
						false, false, false, "", 0L, "", "", false, mtList,
						baList, payModeList, depList, tsList, (List) null,
						(List) null));
				mv.addObject("codeRule", this.codeRuleDao.get("RECEIVE_BILL"));
			} else if (type != null && type.equals("SALE")) {
				mv = new ModelAndView(this.printSaleView);
				mv.addObject("record", this.getBusinessBill(Long.parseLong(id),
						false, false, false, "", 0L, "", "", false, mtList,
						baList, payModeList, depList, tsList, (List) null,
						(List) null));
				mv.addObject("codeRule", this.codeRuleDao.get("BUSINESS_BILL"));
			} else {
				arg20 = false;
				boolean parseImgAcc = false;
				if (ent.getBbPrintImage() != null
						&& ent.getBbPrintImage().equals("Y")) {
					arg20 = true;
					parseImgAcc = true;
				}

				mv = new ModelAndView(this.printView);
				String[] idArr = id.split(";");
				ArrayList arr = new ArrayList();

				for (int i = 0; i < idArr.length; ++i) {
					arr.add(this.getBusinessBill(Long.parseLong(idArr[i]),
							arg20, parseImgAcc, false, "", 0L, "", "", false,
							mtList, baList, payModeList, depList, tsList,
							(List) null, (List) null));
				}

				mv.addObject("list", arr);
				mv.addObject("codeRule", this.codeRuleDao.get("BUSINESS_BILL"));
			}

			mv.addObject("id", id);
			mv.addObject("wcList", wcList);
			return mv;
		}
	}

	public ModelAndView handleReceivableList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "CLIE_UN_RECE")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.receivableListView);
			String searchType = request.getParameter("search_type");
			String contentType = request.getParameter("content_type");
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			String searchKey = "";
			String areaId = "0";
			String etId = "0";
			String elId = "0";
			String creType = "";
			String endDateStr = "";
			String tsId = "0";
			String mngId = "0";
			String cost = "NOT_ZERO";
			Date endDate = null;
			mv.addObject("searchKey", request.getParameter("search_key"));
			mv.addObject("areaId", request.getParameter("area_id"));
			mv.addObject("etId", request.getParameter("et_id"));
			mv.addObject("elId", request.getParameter("el_id"));
			mv.addObject("creType", request.getParameter("cre_type"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			mv.addObject("cost", request.getParameter("cost"));
			mv.addObject("mngName", request.getParameter("mng_name"));
			mv.addObject("mngId", request.getParameter("mng_id"));
			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					searchKey = request.getParameter("search_key");
				} else {
					String managerId1 = request.getParameter("cb_sk");
					String cbArea1 = request.getParameter("cb_area");
					String cList = request.getParameter("cb_et");
					String total = request.getParameter("cb_el");
					String remCost = request.getParameter("cb_cre");
					String perPageNum = request.getParameter("cb_bill_date");
					String pageno = request.getParameter("cb_ts");
					String startIndex = request.getParameter("cb_cost");
					String list = request.getParameter("cb_mng");
					if (managerId1 != null && managerId1.equals("1")) {
						searchKey = request.getParameter("search_key");
						mv.addObject("cbSK", managerId1);
					}

					if (cbArea1 != null && cbArea1.equals("1")) {
						areaId = request.getParameter("area_id");
						mv.addObject("cbArea", cbArea1);
					}

					if (cList != null && cList.equals("1")) {
						etId = request.getParameter("et_id");
						mv.addObject("cbEt", cList);
					}

					if (total != null && total.equals("1")) {
						elId = request.getParameter("el_id");
						mv.addObject("cbEl", total);
					}

					if (remCost != null && remCost.equals("1")) {
						creType = request.getParameter("cre_type");
						mv.addObject("cbCre", remCost);
					}

					if (perPageNum != null && perPageNum.equals("1")) {
						endDateStr = request.getParameter("end_date");
						SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
						endDate = sf.parse(EncCommonHelper.getNextDateStr(
								endDateStr, "yyyy-MM-dd"));
						mv.addObject("cbBillDate", perPageNum);
					}

					if (pageno != null && pageno.equals("1")) {
						tsId = request.getParameter("ts_id");
						mv.addObject("cbTs", pageno);
					}

					if (startIndex != null && startIndex.equals("1")) {
						cost = request.getParameter("cost");
						mv.addObject("cbCost", startIndex);
					}

					if (list != null && list.equals("1")) {
						mngId = request.getParameter("mng_id");
						mv.addObject("cbMng", list);
					}
				}
			} else {
				searchType = "1";
				SimpleDateFormat managerId = new SimpleDateFormat("yyyy-MM-dd");
				Date cbArea = new Date();
				mv.addObject("endDate", managerId.format(cbArea));
				tsId = String.valueOf(ub.getUser().getDfTsId());
				mv.addObject("tsId", tsId);
				mv.addObject("cbTs", "1");
			}

			long managerId2 = 0L;
			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				if (!mngId.equals("0")) {
					if (Long.parseLong(mngId) == ub.getStaffer().getId()) {
						managerId2 = ub.getStaffer().getId();
					} else {
						managerId2 = -2L;
					}
				} else {
					managerId2 = ub.getStaffer().getId();
				}
			} else {
				managerId2 = Long.parseLong(mngId);
			}

			List cList1 = this.businessBillDao.getReceivableListCount(
					searchKey, Long.parseLong(areaId), Long.parseLong(etId),
					Long.parseLong(elId), creType, managerId2, endDate,
					Long.parseLong(tsId), ub, allowStart, cost);
			int total1 = 0;
			BigDecimal remCost1 = new BigDecimal(0);
			if (cList1.size() > 0 && cList1.get(0) != null) {
				Object[] perPageNum1 = (Object[]) cList1.get(0);
				if (perPageNum1[0] != null) {
					total1 = Integer.parseInt(perPageNum1[0].toString());
				}

				if (perPageNum1[4] != null) {
					remCost1 = new BigDecimal(perPageNum1[4].toString());
				}
			}

			if (contentType != null && contentType.equals("EXCEL")) {
				HashMap perPageNum3 = new HashMap();
				List pageno2 = this.businessBillDao.getReceivableList(
						searchKey, Long.parseLong(areaId),
						Long.parseLong(etId), Long.parseLong(elId), creType,
						managerId2, endDate, Long.parseLong(tsId), ub,
						allowStart, cost, 0, total1);
				perPageNum3.put("list", pageno2);
				perPageNum3.put("remCost", remCost1);
				ReceivableListExcelView startIndex2 = new ReceivableListExcelView();
				return new ModelAndView(startIndex2, perPageNum3);
			} else {
				int perPageNum2 = EncCommonHelper.getPageSize(request);
				int pageno1 = EncCommonHelper.getCurrentPageIndex(request,
						total1, perPageNum2);
				int startIndex1 = (pageno1 - 1) * perPageNum2;
				List list1 = this.businessBillDao.getReceivableList(searchKey,
						Long.parseLong(areaId), Long.parseLong(etId),
						Long.parseLong(elId), creType, managerId2, endDate,
						Long.parseLong(tsId), ub, allowStart, cost,
						startIndex1, perPageNum2);
				mv.addObject("qr", EncCommonHelper.parseQueryResult(list1,
						total1, perPageNum2, pageno1));
				mv.addObject("remCost", remCost1);
				mv.addObject("areaList", this.areaDao.getList(true));
				mv.addObject("estTypeList",
						this.establishmentTypeDao.getList(true));
				mv.addObject("estLevelList",
						this.establishmentLevelDao.getList(true));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				mv.addObject("searchType", searchType);
				mv.addObject("printId", request.getParameter("print_id"));
				mv.addObject("printBill", request.getParameter("print_bill"));
				mv.addObject("printDetail",
						request.getParameter("print_detail"));
				return mv;
			}
		}
	}

	public ModelAndView handleListForEstablismnent(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.listForEstablishmentView);
		String id = request.getParameter("id");
		QueryParameterBean b = EncBusinessBillMACtrHelper
				.handleListForEstablismnent(request, this.dataSource);
		String[] countObjs = new String[]{"sum(b.cost)", "sum(b.imprest)"};
		QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
				b.getPageSize(), b.getQParas(), b.getOParas(), (String[]) null,
				b.getShortNameMap(), b.getRetObjs(), countObjs);
		Object[] objs = qr.getExtCount();
		mv.addObject("costTotal", objs[0]);
		mv.addObject("imprestTotal", objs[1]);
		mv.addObject("qr", qr);
		mv.addObject(
				"est",
				this.businessBillDao.get(Establishment.class,
						Long.parseLong(id)));
		mv.addObject("id", id);
		return mv;
	}

	public ModelAndView handleListForAccount(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String contentType = request.getParameter("content_type");
		String clientId = request.getParameter("client_id");
		List mtList = this.makeTypeDao.getList(false);
		String[] idArr = clientId.split(";");
		ArrayList arr = new ArrayList();
		QueryParameterBean b = null;
		int itemTotal = 0;

		for (int mv = 0; mv < idArr.length; ++mv) {
			Establishment v = (Establishment) this.businessBillDao.get(
					Establishment.class, Long.parseLong(idArr[mv]));
			List contactList = this.establishmentContactDao.getList(Long
					.parseLong(idArr[mv]));
			EstablishmentContact contact = null;
			if (contactList.size() > 0) {
				contact = (EstablishmentContact) contactList.get(0);
			}

			b = EncBusinessBillMACtrHelper.handleListForAccountCost(request,
					"INNER", idArr[mv], this.dataSource);
			List list = this.queryDao.doQuery(b.getQParas(),
					(OrderParameterCarrier[]) null, (String[]) null,
					b.getShortNameMap(), b.getRetObjs(), (String[]) null)
					.getList();
			BigDecimal costTotal = new BigDecimal(0);
			BigDecimal collectTotal = new BigDecimal(0);
			BigDecimal adjustTotal = new BigDecimal(0);
			BigDecimal favTotal = new BigDecimal(0);
			if (list != null && !list.isEmpty()) {
				Object[] qr = (Object[]) list.get(0);
				if (qr[0] != null) {
					costTotal = (BigDecimal) qr[0];
				}

				if (qr[1] != null) {
					collectTotal = (BigDecimal) qr[1];
				}

				if (qr[2] != null) {
					adjustTotal = (BigDecimal) qr[2];
				}

				if (qr[3] != null) {
					favTotal = (BigDecimal) qr[3];
				}
			}

			b = EncBusinessBillMACtrHelper.handleListForAccountList(request,
					"INNER", idArr[mv], this.dataSource);
			QueryResult arg24 = this.queryDao.doQuery(b.getQParas(),
					b.getOParas(), (String[]) null, b.getShortNameMap(),
					b.getRetObjs(), (String[]) null);
			Object[] objs = new Object[]{arg24.getList(), v, contact,
					costTotal, collectTotal, adjustTotal, favTotal,
					costTotal.add(adjustTotal).subtract(collectTotal)};
			arr.add(objs);
			itemTotal += arg24.getList().size();
		}

		if (contentType != null
				&& (contentType.equals("EXCEL") || contentType
						.equals("EXCEL_PRINT"))) {
			HashMap arg21 = new HashMap();
			arg21.put("list", arr);
			arg21.put("mtList", mtList);
			arg21.put("start_date", request.getParameter("start_date"));
			arg21.put("end_date", request.getParameter("end_date"));
			arg21.put("include_sub", request.getParameter("include_sub"));
			if (contentType.equals("EXCEL_PRINT")) {
				BusinessBillListForAccountPrintExcelView arg23 = new BusinessBillListForAccountPrintExcelView();
				return new ModelAndView(arg23, arg21);
			} else {
				BusinessBillListForAccountExcelView arg22 = new BusinessBillListForAccountExcelView();
				return new ModelAndView(arg22, arg21);
			}
		} else {
			ModelAndView arg20 = new ModelAndView(this.listForAccountView);
			arg20.addAllObjects(b.getParameters());
			arg20.addObject("list", arr);
			arg20.addObject("itemTotal", Integer.valueOf(itemTotal));
			arg20.addObject("mtList", mtList);
			arg20.addObject("client_id", clientId);
			arg20.addObject("codeRule", this.codeRuleDao.get("BUSINESS_BILL"));
			arg20.addObject("printId", request.getParameter("print_id"));
			arg20.addObject("printBill", request.getParameter("print_bill"));
			arg20.addObject("printDetail", request.getParameter("print_detail"));
			return arg20;
		}
	}

	public ModelAndView handleItemListForEstablishment(
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ModelAndView mv = new ModelAndView(this.itemListForEstablishmentView);
		String clientId = request.getParameter("id");
		mv.addObject("id", clientId);
		QueryParameterBean b = EncBusinessBillMACtrHelper
				.handleItemListForEstablishment(request, this.dataSource);
		String[] countObjs = new String[]{"sum(i.cost)"};
		QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
				b.getPageSize(), b.getQParas(), b.getOParas(), (String[]) null,
				b.getShortNameMap(), b.getRetObjs(), countObjs);
		mv.addObject("costTotal", qr.getExtCount()[0]);
		List makeTypeList = this.makeTypeDao.getList(false);

		for (int i = 0; i < qr.getList().size(); ++i) {
			Object[] objs = (Object[]) qr.getList().get(i);
			BusinessBillItemBean bean = new BusinessBillItemBean();
			BusinessBillItem item = (BusinessBillItem) objs[1];
			bean.setBusinessBillItem(item);
			bean.setMakeTypeName(EncCommonHelper.getSimpleObjectName(
					makeTypeList, item.getMakeTypeId()));
			objs[1] = bean;
		}

		mv.addObject("qr", qr);
		mv.addObject(
				"est",
				this.businessBillDao.get(Establishment.class,
						Long.parseLong(clientId)));
		return mv;
	}

	public ModelAndView handleItemListForSelect(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.itemListForSelectView);
		QueryParameterBean b = EncBusinessBillMACtrHelper
				.handleItemListForSelect(request, this.dataSource);
		QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
				b.getPageSize(), b.getQParas(), b.getOParas(), (String[]) null,
				b.getShortNameMap(), b.getRetObjs(), (String[]) null);
		List makeTypeList = this.makeTypeDao.getList(false);

		for (int i = 0; i < qr.getList().size(); ++i) {
			Object[] objs = (Object[]) qr.getList().get(i);
			BusinessBillItemBean bean = new BusinessBillItemBean();
			BusinessBillItem item = (BusinessBillItem) objs[1];
			bean.setBusinessBillItem(item);
			bean.setMakeTypeName(EncCommonHelper.getSimpleObjectName(
					makeTypeList, item.getMakeTypeId()));
			objs[1] = bean;
		}

		mv.addObject("qr", qr);
		mv.addAllObjects(b.getParameters());
		mv.addObject("workCenterList", this.workCenterDao.getList(false));
		return mv;
	}

	public ModelAndView handleItemListForCooperSelect(
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ModelAndView mv = new ModelAndView(this.itemListForCooperSelectView);
		String type = request.getParameter("type");
		if (type != null && type.equals("MULTI")) {
			mv = new ModelAndView(this.itemListForCooperMultiSelectView);
		}

		QueryParameterBean b = EncBusinessBillMACtrHelper
				.handleItemListForCooperSelect(request, this.dataSource);
		QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
				b.getPageSize(), b.getQParas(), b.getOParas(), (String[]) null,
				b.getShortNameMap(), b.getRetObjs(), (String[]) null);
		List makeTypeList = this.makeTypeDao.getList(false);

		for (int i = 0; i < qr.getList().size(); ++i) {
			Object[] objs = (Object[]) qr.getList().get(i);
			BusinessBillItemBean bean = new BusinessBillItemBean();
			BusinessBillItem item = (BusinessBillItem) objs[1];
			bean.setBusinessBillItem(item);
			bean.setMakeTypeName(EncCommonHelper.getSimpleObjectName(
					makeTypeList, item.getMakeTypeId()));
			objs[1] = bean;
		}

		mv.addObject("qr", qr);
		mv.addAllObjects(b.getParameters());
		return mv;
	}

	public ModelAndView handleListForEditPrice(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_EDIT_PRIC")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForEditPriceView);
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleListForEditPrice(request, this.dataSource);
			QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
					b.getPageSize(), b.getQParas(), b.getOParas(),
					(String[]) null, b.getShortNameMap(), b.getRetObjs(),
					(String[]) null);
			mv.addObject("qr", qr);
			mv.addAllObjects(b.getParameters());
			mv.addObject("departmentList", this.departmentDao.getList(true));
			mv.addObject("tsList", PageHelper.getTallySetList(this.tallySetDao,
					EncCommonHelper.getCurrentUserAccount(request)));
			return mv;
		}
	}

	public ModelAndView handleListForModify(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_MODI")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForModifyView);
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleListForModify(request, this.dataSource);
			QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
					b.getPageSize(), b.getQParas(), b.getOParas(),
					(String[]) null, b.getShortNameMap(), b.getRetObjs(),
					(String[]) null);
			mv.addObject("qr", qr);
			mv.addAllObjects(b.getParameters());
			mv.addObject("departmentList", this.departmentDao.getList(true));
			mv.addObject("tsList", PageHelper.getTallySetList(this.tallySetDao,
					EncCommonHelper.getCurrentUserAccount(request)));
			return mv;
		}
	}

	public ModelAndView handleItemListAlone(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.itemListAloneView);
		String id = request.getParameter("id");
		String type = request.getParameter("type");
		String mark = request.getParameter("mark");
		List itemList = this.businessBillItemDao.getListWidthExt(Long
				.parseLong(id));
		List makeTypeList = this.makeTypeDao.getList(false);
		ArrayList arr = new ArrayList();

		for (int i = 0; i < itemList.size(); ++i) {
			Object[] objs = (Object[]) itemList.get(i);
			BusinessBillItem item = (BusinessBillItem) objs[0];
			BusinessBillItemExt ie = (BusinessBillItemExt) objs[1];
			boolean itemOk = true;
			if (type != null
					&& type.equals("COOPER_UNCOMP")
					&& (item.getIsCoop().equals("N") || ie.getCoopComp()
							.equals("Y"))) {
				itemOk = false;
			}

			if (itemOk) {
				BusinessBillItemBean bean = new BusinessBillItemBean();
				bean.setBusinessBillItem(item);
				bean.setBusinessBillItemExt(ie);
				bean.setMakeTypeName(EncCommonHelper.getSimpleObjectName(
						makeTypeList, item.getMakeTypeId()));
				arr.add(bean);
			}
		}

		mv.addObject("itemList", arr);
		mv.addObject("mark", mark);
		return mv;
	}

	public ModelAndView handlePrintLog(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		String id = request.getParameter("id");
		String type = request.getParameter("type");
		String cost = request.getParameter("cost");
		String[] ids = id.split(";");
		String[] costs = (String[]) null;
		if (cost != null && !cost.equals("")) {
			costs = cost.split(";");
		}

		long[] idArr = new long[ids.length];
		String[] costArr = new String[ids.length];

		for (int msg = 0; msg < idArr.length; ++msg) {
			idArr[msg] = Long.parseLong(ids[msg]);
			if (costs != null) {
				costArr[msg] = costs[msg];
			} else {
				costArr[msg] = "";
			}
		}

		String arg13 = "";
		if (ub != null) {
			this.businessBillDao.updatePrintNum(idArr, ub.getStaffer()
					.getStafferName());

			for (int out = 0; out < idArr.length; ++out) {
				PrintLog p = new PrintLog();
				p.setId(this.idGenerator.getId(PrintLog.class.getName()));
				p.setPrinterName(ub.getStaffer().getStafferName());
				p.setRelId(idArr[out]);
				p.setRelType("BUSINESS_BILL");
				p.setPrintType(type);
				p.setCost(costArr[out]);
				this.businessBillDao.save(p);
			}

			arg13 = "OK";
		} else {
			arg13 = "NO_LOGIN";
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ServletOutputStream arg14 = response.getOutputStream();
		arg14.write(arg13.getBytes());
		arg14.flush();
		arg14.close();
		return null;
	}

	public ModelAndView handleItemSearchResult(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_ITEM_SEAR")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.itemSearchResultView);
			String contentType = request.getParameter("content_type");
			List depList = this.departmentDao.getList(false);
			List mtList = this.makeTypeDao.getList(false);
			List areaList = this.areaDao.getList(false);
			List etList = this.establishmentTypeDao.getList(false);
			List elList = this.establishmentLevelDao.getList(false);
			List wcList = this.workCenterDao.getList(false);
			List proList = this.workProcessDao.getList(0L, false);
			List baList = this.bankAccountDao.getList("", "");
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleItemSearchResult(request, this.dataSource);
			QueryResult qr;
			if (contentType != null && contentType.equals("EXCEL")) {
				qr = this.queryDao.doQuery(b.getQParas(), b.getOParas(),
						(String[]) null, b.getShortNameMap(), b.getRetObjs(),
						(String[]) null);
			} else {
				qr = this.queryDao.doQuery(b.getCurrentPage(), b.getPageSize(),
						b.getQParas(), b.getOParas(), (String[]) null,
						b.getShortNameMap(), b.getRetObjs(), (String[]) null);
			}

			for (int retObjs = 0; retObjs < qr.getList().size(); ++retObjs) {
				Object[] list = (Object[]) qr.getList().get(retObjs);
				BusinessBill costTotal = (BusinessBill) list[0];
				String squareTotal = "";
				if (costTotal.getBankAccountId() != 0L) {
					for (int lengMTotal = 0; lengMTotal < baList.size(); ++lengMTotal) {
						BankAccount lengCmTotal = (BankAccount) baList
								.get(lengMTotal);
						if (lengCmTotal.getId() == costTotal.getBankAccountId()) {
							squareTotal = lengCmTotal.getBankName();
							if (lengCmTotal.getAccountName() != null
									&& !lengCmTotal.getAccountName().equals("")) {
								squareTotal = squareTotal + "("
										+ lengCmTotal.getAccountName() + ")";
								break;
							}
						}
					}
				}

				list[13] = squareTotal;
			}

			String[] arg24 = new String[]{"i.priceType", "i.lengType",
					"sum(i.cost)", "sum(i.squareNum)", "sum(i.amount)"};
			List arg25 = this.queryDao.doQuery(b.getQParas(),
					(OrderParameterCarrier[]) null,
					new String[]{"i.priceType", "i.lengType"},
					b.getShortNameMap(), arg24, (String[]) null).getList();
			BigDecimal arg26 = new BigDecimal(0);
			BigDecimal arg27 = new BigDecimal(0);
			BigDecimal arg28 = new BigDecimal(0);
			BigDecimal arg29 = new BigDecimal(0);
			BigDecimal amountTotal = new BigDecimal(0);

			for (int billTotal = 0; billTotal < arg25.size(); ++billTotal) {
				Object[] ub = (Object[]) arg25.get(billTotal);
				if (ub[0] != null) {
					if (ub[2] != null) {
						arg26 = arg26.add((BigDecimal) ub[2]);
					}

					if (ub[0].toString().equals("AREA")) {
						arg27 = arg27.add((BigDecimal) ub[3]);
					} else if (ub[0].toString().equals("LENGTH")) {
						if (ub[1].toString().equals("M")) {
							arg28 = arg28.add((BigDecimal) ub[3]);
						} else {
							arg29 = arg29.add((BigDecimal) ub[3]);
						}
					} else if (ub[0].toString().equals("AMOUNT")) {
						amountTotal = amountTotal.add((BigDecimal) ub[4]);
					}
				}
			}

			arg27 = arg27.setScale(2, 4);
			arg28 = arg28.setScale(2, 4);
			arg29 = arg29.setScale(2, 4);
			arg25 = this.queryDao.doQuery(b.getQParas(),
					(OrderParameterCarrier[]) null, (String[]) null,
					b.getShortNameMap(), new String[]{"count(distinct b.id)"},
					(String[]) null).getList();
			String arg30 = "0";
			if (arg25.size() > 0 && arg25.get(0) != null) {
				arg30 = arg25.get(0).toString();
			}

			if (contentType != null && contentType.equals("EXCEL")) {
				HashMap arg32 = new HashMap();
				arg32.put("list", qr.getList());
				arg32.put("costTotal", arg26);
				arg32.put("squareTotal", arg27);
				arg32.put("lengMTotal", arg28);
				arg32.put("lengCmTotal", arg29);
				arg32.put("amountTotal", amountTotal);
				arg32.put("billTotal", arg30);
				arg32.put("depList", depList);
				arg32.put("mtList", mtList);
				arg32.put("areaList", areaList);
				arg32.put("etList", etList);
				arg32.put("elList", elList);
				arg32.put("wcList", wcList);
				arg32.put("proList", proList);
				BusinessBillItemListExcelView arg33 = new BusinessBillItemListExcelView();
				return new ModelAndView(arg33, arg32);
			} else {
				mv.addAllObjects(b.getParameters());
				mv.addObject("qr", qr);
				mv.addObject("costTotal", arg26);
				mv.addObject("squareTotal", arg27);
				mv.addObject("lengMTotal", arg28);
				mv.addObject("lengCmTotal", arg29);
				mv.addObject("amountTotal", amountTotal);
				mv.addObject("billTotal", arg30);
				mv.addObject("depList", depList);
				mv.addObject("mtList", mtList);
				mv.addObject("areaList", areaList);
				mv.addObject("etList", etList);
				mv.addObject("elList", elList);
				mv.addObject("wcList", wcList);
				mv.addObject("proList", proList);
				UserBean arg31 = EncCommonHelper.getCurrentUserAccount(request);
				EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
				mv.addObject("myWcList", PageHelper.getWorkCenterList(
						this.workCenterDao, arg31, ent));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, arg31));
				return mv;
			}
		}
	}

	public ModelAndView handleListForAccountForm(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_ACCO")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			Date now = new Date();
			SimpleDateFormat dateSf = new SimpleDateFormat("yyyy-MM-dd");
			String endDate = dateSf.format(now);
			return (new ModelAndView(this.listForAccountFormView)).addObject(
					"end_date", endDate);
		}
	}

	public ModelAndView handleSelectMaker(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.selectMakerView);
	}

	public ModelAndView handleListForClose(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_CLOS")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			String contentType = request.getParameter("content_type");
			String searchKey = request.getParameter("search_key");
			String cost = request.getParameter("cost");
			String status = request.getParameter("status");
			String tsId = request.getParameter("ts_id");
			String orderBy = request.getParameter("order_by");
			if (cost == null || cost.equals("")) {
				cost = "NOT_ZERO";
			}

			long managerId = 0L;
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				managerId = ub.getStaffer().getId();
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			if (tsId == null || tsId.equals("")) {
				tsId = String.valueOf(ub.getUser().getDfTsId());
			}

			int total = 0;
			BigDecimal costTotal = new BigDecimal(0);
			List cl = this.businessBillDao.getListForCloseCount(searchKey,
					cost, status, managerId, Long.parseLong(tsId), ub,
					allowStart);
			if (!cl.isEmpty() && cl.get(0) != null) {
				Object[] mv = (Object[]) cl.get(0);
				if (mv[0] != null) {
					total = Integer.parseInt(mv[0].toString());
				}

				if (mv[1] != null) {
					costTotal = (BigDecimal) mv[1];
				}
			}

			if (contentType != null && contentType.equals("EXCEL")) {
				List mv2 = this.businessBillDao.getListForClose(searchKey,
						cost, status, managerId, Long.parseLong(tsId), ub,
						allowStart, orderBy, 0, total);
				HashMap perPageNum1 = new HashMap();
				perPageNum1.put("list", mv2);
				perPageNum1.put("costTotal", costTotal);
				BusinessBillListForCloseExcelView pageno1 = new BusinessBillListForCloseExcelView();
				return new ModelAndView(pageno1, perPageNum1);
			} else {
				ModelAndView mv1 = new ModelAndView(this.listForCloseView);
				int perPageNum = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						total, perPageNum);
				int startIndex = (pageno - 1) * perPageNum;
				List list = this.businessBillDao.getListForClose(searchKey,
						cost, status, managerId, Long.parseLong(tsId), ub,
						allowStart, orderBy, startIndex, perPageNum);
				mv1.addObject("qr", EncCommonHelper.parseQueryResult(list,
						total, perPageNum, pageno));
				mv1.addObject("costTotal", costTotal);
				mv1.addObject("searchKey", searchKey);
				mv1.addObject("status", status);
				mv1.addObject("cost", cost);
				mv1.addObject("tsId", tsId);
				mv1.addObject("orderBy", orderBy);
				mv1.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				return mv1;
			}
		}
	}

	public ModelAndView handleInfoForClose(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.infoForCloseView);
		String id = request.getParameter("id");
		List wcList = this.workCenterDao.getList(false);
		List depList = this.departmentDao.getList(false);
		List tsList = this.tallySetDao.getList(false);
		List payModeList = this.payModeDao.getList(false);
		List baList = this.bankAccountDao.getList("", "");
		List mtList = this.makeTypeDao.getList(false);
		mv.addObject("record", this.getBusinessBill(Long.parseLong(id), true,
				false, false, "", 0L, "", "", false, mtList, baList,
				payModeList, depList, tsList, (List) null, (List) null));
		mv.addObject("workCenterList", wcList);
		return mv;
	}

	public ModelAndView handleClose(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_CLOS")) {
			throw new Exception("Permission deny!");
		} else {
			String idStr = request.getParameter("id_str");
			String[] arr = idStr.split(";");
			String msg = "";
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);

			try {
				for (int w = 0; w < arr.length; ++w) {
					this.businessBillService.txClose(Long.parseLong(arr[w]),
							ent.getBusiClos(), ub.getStaffer().getId(), ub
									.getStaffer().getStafferName(),
							this.businessBillDao, this.businessBillItemDao);
				}

				msg = "结清成功！";
			} catch (CannotAcquireLockException arg9) {
				msg = "事务冲突故障，请重新操作！";
			}

			mv.addObject("returnValue", "1");
			EncCommonHelper.setAlertMessage(request, msg);
			return mv;
		}
	}

	public ModelAndView handleListForUnClose(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_UN_CLOS")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForUnCloseView);
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleListForUnClose(request, this.dataSource);
			QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
					b.getPageSize(), b.getQParas(), b.getOParas(),
					b.getGParas(), b.getShortNameMap(), b.getRetObjs(),
					(String[]) null);
			mv.addAllObjects(b.getParameters());
			mv.addObject("qr", qr);
			mv.addObject("depList", this.departmentDao.getList(false));
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, ub));
			return mv;
		}
	}

	public ModelAndView handleInfoForUnClose(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.infoForUnCloseView);
		String id = request.getParameter("id");
		List wcList = this.workCenterDao.getList(false);
		List depList = this.departmentDao.getList(false);
		List tsList = this.tallySetDao.getList(false);
		List payModeList = this.payModeDao.getList(false);
		List baList = this.bankAccountDao.getList("", "");
		List mtList = this.makeTypeDao.getList(false);
		mv.addObject("record", this.getBusinessBill(Long.parseLong(id), true,
				false, false, "", 0L, "", "", false, mtList, baList,
				payModeList, depList, tsList, (List) null, (List) null));
		mv.addObject("workCenterList", wcList);
		return mv;
	}

	public ModelAndView handleUnClose(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_UN_CLOS")) {
			throw new Exception("Permission deny!");
		} else {
			String id = request.getParameter("id");
			String[] idArr = id.split(";");

			for (int i = 0; i < idArr.length; ++i) {
				if (idArr[i] != null && !idArr[i].equals("")) {
					this.businessBillDao.unClose(Long.parseLong(idArr[i]));
				}
			}

			mv.addObject("returnValue", String.valueOf(idArr.length));
			EncCommonHelper.setAlertMessage(request, "反结清成功");
			return mv;
		}
	}

	public ModelAndView handleListForUnComplete(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_UN_COMP")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForUnCompleteView);
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleListForUnComplete(request, this.dataSource);
			QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
					b.getPageSize(), b.getQParas(), b.getOParas(),
					b.getGParas(), b.getShortNameMap(), b.getRetObjs(),
					(String[]) null);
			mv.addAllObjects(b.getParameters());
			List list = qr.getList();
			ArrayList arr = new ArrayList();

			for (int ub = 0; ub < list.size(); ++ub) {
				Object[] ent = (Object[]) list.get(ub);
				Object[] objs = new Object[3];
				BusinessBill bill = (BusinessBill) this.businessBillItemDao
						.get(BusinessBill.class,
								Long.parseLong(ent[0].toString()));
				objs[0] = bill;
				objs[1] = ent[1];
				objs[2] = ent[2];
				if (bill != null) {
					String linkman = bill.getLinkman();
					if (linkman != null && !linkman.equals("")) {
						objs[1] = objs[1] + "(" + linkman + ")";
					}
				}

				arr.add(objs);
			}

			qr.setList(arr);
			mv.addObject("qr", qr);
			UserBean arg12 = EncCommonHelper.getCurrentUserAccount(request);
			EnterpriseInfo arg13 = EncCommonHelper.getEnterpriseInfo(request);
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, arg12));
			mv.addObject("wcList", PageHelper.getWorkCenterList(
					this.workCenterDao, arg12, arg13));
			mv.addObject("workCenterList", this.workCenterDao.getList(false));
			return mv;
		}
	}

	public ModelAndView handleInfoForUnComplete(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.infoForUnCompleteView);
		String id = request.getParameter("id");
		String wcId = request.getParameter("wc_id");
		List depList = this.departmentDao.getList(false);
		List tsList = this.tallySetDao.getList(false);
		List payModeList = this.payModeDao.getList(false);
		List baList = this.bankAccountDao.getList("", "");
		List mtList = this.makeTypeDao.getList(false);
		mv.addObject("record", this.getBusinessBill(Long.parseLong(id), true,
				false, false, "DESIGN", Long.parseLong(wcId), "", "Y", false,
				mtList, baList, payModeList, depList, tsList, (List) null,
				(List) null));
		mv.addObject("wc", this.businessBillDao.get(WorkCenter.class,
				Long.parseLong(wcId)));
		mv.addObject("wcId", wcId);
		return mv;
	}

	public ModelAndView handleUnComplete(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_UN_COMP")) {
			throw new Exception("Permission deny!");
		} else {
			String itemIdStr = request.getParameter("item_id_str");
			String billId = request.getParameter("bill_id");
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);

			String msg;
			try {
				this.businessBillService.txWcUnComplete(Long.parseLong(billId),
						itemIdStr, ub, this.businessBillDao,
						this.businessBillItemDao, this.outBillDao,
						this.outBillItemDao, this.stockDao,
						this.stockBalanceDao, this.idGenerator);
				msg = "保存成功！";
			} catch (CannotAcquireLockException arg8) {
				msg = "事务冲突故障，请重新操作！";
			}

			mv.addObject("returnValue", billId);
			EncCommonHelper.setAlertMessage(request, msg);
			return mv;
		}
	}

	public ModelAndView handleProfitSearchResult(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_PROF")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.profitSearchResultView);
			String contentType = request.getParameter("content_type");
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleProfitSearchResult(request, this.dataSource);
			String[] countObjs = new String[]{"sum(b.cost)",
					"sum(be.adjustCost)", "sum(p.profitCost)"};
			BigDecimal zero = new BigDecimal(0);
			BigDecimal hund = new BigDecimal(100);
			BigDecimal billCost;
			BigDecimal profitCost;
			BigDecimal profitPercent;
			BigDecimal arg19;
			if (contentType != null && contentType.equals("EXCEL")) {
				HashMap arg16 = new HashMap();
				QueryResult arg18 = this.queryDao.doQuery(b.getQParas(),
						b.getOParas(), (String[]) null, b.getShortNameMap(),
						b.getRetObjs(), countObjs);

				for (int arg20 = 0; arg20 < arg18.getList().size(); ++arg20) {
					Object[] arg21 = (Object[]) arg18.getList().get(arg20);
					profitCost = ((BigDecimal) arg21[3])
							.add((BigDecimal) arg21[5]);
					if (profitCost.compareTo(zero) != 0) {
						arg21[20] = ((BigDecimal) arg21[12]).multiply(hund)
								.divide(profitCost, 2, 4);
					}
				}

				arg16.put("list", arg18.getList());
				arg19 = (BigDecimal) arg18.getExtCount()[0];
				billCost = (BigDecimal) arg18.getExtCount()[1];
				profitCost = arg19.add(billCost);
				profitPercent = (BigDecimal) arg18.getExtCount()[2];
				BigDecimal arg22 = new BigDecimal(0);
				if (profitCost.compareTo(zero) != 0) {
					arg22 = profitPercent.multiply(hund).divide(profitCost, 2,
							4);
				}

				arg16.put("profitPercent", arg22);
				arg16.put("profitCost", profitPercent);
				BusinessProfitListExcelView v = new BusinessProfitListExcelView();
				return new ModelAndView(v, arg16);
			} else {
				QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
						b.getPageSize(), b.getQParas(), b.getOParas(),
						(String[]) null, b.getShortNameMap(), b.getRetObjs(),
						countObjs);

				for (int cost = 0; cost < qr.getList().size(); ++cost) {
					Object[] adjustCost = (Object[]) qr.getList().get(cost);
					billCost = ((BigDecimal) adjustCost[3])
							.add((BigDecimal) adjustCost[5]);
					if (billCost.compareTo(zero) != 0) {
						adjustCost[20] = ((BigDecimal) adjustCost[12])
								.multiply(hund).divide(billCost, 2, 4);
					}
				}

				mv.addAllObjects(b.getParameters());
				mv.addObject("qr", qr);
				BigDecimal arg17 = (BigDecimal) qr.getExtCount()[0];
				arg19 = (BigDecimal) qr.getExtCount()[1];
				billCost = arg17.add(arg19);
				profitCost = (BigDecimal) qr.getExtCount()[2];
				profitPercent = new BigDecimal(0);
				if (billCost.compareTo(zero) != 0) {
					profitPercent = profitCost.multiply(hund).divide(billCost,
							2, 4);
				}

				mv.addObject("profitPercent", profitPercent);
				mv.addObject("profitCost", profitCost);
				UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				mv.addObject("departmentList", this.departmentDao.getList(true));
				return mv;
			}
		}
	}

	public ModelAndView handleListForModifySelf(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.listForModifySelfView);
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_MODI_SELF")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			String searchKey = request.getParameter("search_key");
			String tsId = request.getParameter("ts_id");
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			if (tsId == null || tsId.equals("")) {
				tsId = String.valueOf(ub.getUser().getDfTsId());
			}

			int perPageNum = EncCommonHelper.getPageSize(request);
			int total = this.businessBillDao.getListForModifySelfCount(
					searchKey, Long.parseLong(tsId), ub);
			int pageno = EncCommonHelper.getCurrentPageIndex(request, total,
					perPageNum);
			int startIndex = (pageno - 1) * perPageNum;
			List list = this.businessBillDao.getListForModifySelf(searchKey,
					Long.parseLong(tsId), ub, startIndex, perPageNum);
			int[] flags = new int[list.size()];

			for (int i = 0; i < list.size(); ++i) {
				Object[] objs = (Object[]) list.get(i);
				long relationId = ((BusinessBill) objs[0]).getId();
				flags[i] = this.messageDao.getMessageCount(relationId, ub
						.getStaffer().getId());
			}

			mv.addObject("qr", EncCommonHelper.parseQueryResult(list, total,
					perPageNum, pageno));
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, ub));
			mv.addObject("flags", flags);
			mv.addObject("searchKey", searchKey);
			mv.addObject("tsId", tsId);
			return mv;
		}
	}

	public ModelAndView handleInfo(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.infoView);
		String id = request.getParameter("id");
		List wcList = this.workCenterDao.getList(false);
		List depList = this.departmentDao.getList(false);
		List tsList = this.tallySetDao.getList(false);
		List payModeList = this.payModeDao.getList(false);
		List baList = this.bankAccountDao.getList("", "");
		List mtList = this.makeTypeDao.getList(false);
		mv.addObject("record", this.getBusinessBill(Long.parseLong(id), true,
				false, false, "", 0L, "", "", false, mtList, baList,
				payModeList, depList, tsList, (List) null, (List) null));
		mv.addObject("workCenterList", wcList);
		return mv;
	}

	public ModelAndView handleListForCooComp(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "COOP_COMP")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForCooCompView);
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleListForCooComplete(request, this.dataSource);
			QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
					b.getPageSize(), b.getQParas(), b.getOParas(),
					b.getGParas(), b.getShortNameMap(), b.getRetObjs(),
					(String[]) null);
			mv.addAllObjects(b.getParameters());
			List list = qr.getList();
			ArrayList arr = new ArrayList();

			for (int ub = 0; ub < list.size(); ++ub) {
				Object[] tmpObjs = (Object[]) list.get(ub);
				Object[] objs = new Object[2];
				BusinessBill bill = (BusinessBill) this.businessBillItemDao
						.get(BusinessBill.class,
								Long.parseLong(tmpObjs[0].toString()));
				objs[0] = bill;
				objs[1] = tmpObjs[1];
				if (bill != null) {
					String linkman = bill.getLinkman();
					if (linkman != null && !linkman.equals("")) {
						objs[1] = objs[1] + "(" + linkman + ")";
					}
				}

				arr.add(objs);
			}

			qr.setList(arr);
			mv.addObject("qr", qr);
			UserBean arg12 = EncCommonHelper.getCurrentUserAccount(request);
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, arg12));
			return mv;
		}
	}

	public ModelAndView handleInfoForCooComp(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.infoForCooCompView);
		String id = request.getParameter("id");
		List depList = this.departmentDao.getList(false);
		List tsList = this.tallySetDao.getList(false);
		List payModeList = this.payModeDao.getList(false);
		List baList = this.bankAccountDao.getList("", "");
		List mtList = this.makeTypeDao.getList(false);
		mv.addObject("record", this.getBusinessBill(Long.parseLong(id), true,
				false, false, "COOPER", 0L, "Y", "N", false, mtList, baList,
				payModeList, depList, tsList, (List) null, (List) null));
		mv.addObject("mtList", mtList);
		mv.addObject(
				"coopList",
				this.cooperBillItemDao.getListForBusinessBill(
						Long.parseLong(id), false));
		return mv;
	}

	public ModelAndView handleListForCooUnComp(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "COOP_UN_COMP")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForCooUnCompView);
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleListForCooUnComplete(request, this.dataSource);
			QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
					b.getPageSize(), b.getQParas(), b.getOParas(),
					b.getGParas(), b.getShortNameMap(), b.getRetObjs(),
					(String[]) null);
			mv.addAllObjects(b.getParameters());
			List list = qr.getList();
			ArrayList arr = new ArrayList();

			for (int ub = 0; ub < list.size(); ++ub) {
				Object[] tmpObjs = (Object[]) list.get(ub);
				Object[] objs = new Object[2];
				BusinessBill bill = (BusinessBill) this.businessBillItemDao
						.get(BusinessBill.class,
								Long.parseLong(tmpObjs[0].toString()));
				objs[0] = bill;
				objs[1] = tmpObjs[1];
				if (bill != null) {
					String linkman = bill.getLinkman();
					if (linkman != null && !linkman.equals("")) {
						objs[1] = objs[1] + "(" + linkman + ")";
					}
				}

				arr.add(objs);
			}

			qr.setList(arr);
			mv.addObject("qr", qr);
			UserBean arg12 = EncCommonHelper.getCurrentUserAccount(request);
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, arg12));
			return mv;
		}
	}

	public ModelAndView handleInfoForCooUnComp(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.infoForCooUnCompView);
		String id = request.getParameter("id");
		List depList = this.departmentDao.getList(false);
		List tsList = this.tallySetDao.getList(false);
		List payModeList = this.payModeDao.getList(false);
		List baList = this.bankAccountDao.getList("", "");
		List mtList = this.makeTypeDao.getList(false);
		mv.addObject("record", this.getBusinessBill(Long.parseLong(id), true,
				false, false, "COOPER", 0L, "Y", "Y", false, mtList, baList,
				payModeList, depList, tsList, (List) null, (List) null));
		return mv;
	}

	public ModelAndView handleCooComp(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		if (!EncCommonHelper.checkPrivilege(request, "COOP_COMP")) {
			throw new Exception("Permission deny!");
		} else {
			String itemIdStr = request.getParameter("item_id_str");
			String billId = request.getParameter("bill_id");
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
			List wcList = this.workCenterDao.getList(false);
			CodeRule obCr = this.codeRuleDao.get("OUT_BILL");
			List mtList = this.makeTypeDao.getList(false);
			String customTxt = "";
			boolean noCompOthe = false;
			boolean saFolComp = false;
			boolean saBusComp = false;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_COMP_OTHE")) {
				noCompOthe = true;
			}

			SmsAlert sa = this.smsAlertDao.get("BUS_COMPLETE");
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				saBusComp = true;
				customTxt = sa.getCustomTxt();
			}

			sa = this.smsAlertDao.get("FOL_COMP");
			Object saFolRecList = new ArrayList();
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				saFolComp = true;
				saFolRecList = this.smsAlertDao.getReceiverList(sa.getId());
			}

			String msg;
			try {
				Map w = this.businessBillService.txCooComplete(
						Long.parseLong(billId), itemIdStr, obCr, wcList,
						mtList, ub, noCompOthe, this.businessBillDao,
						this.businessBillItemDao, this.outBillDao,
						this.stockDao, this.stockBalanceDao,
						this.serialNumberDao, this.idGenerator);
				if (w.get("comp") != null) {
					try {
						if (saFolComp) {
							PageHelper.sendFolCompMsg(w, ub,
									(List) saFolRecList, this.stafferDao,
									this.idGenerator);
						}
					} catch (Exception arg20) {
						arg20.printStackTrace();
					}

					try {
						if (saBusComp) {
							PageHelper.sendBusCompSms(w, customTxt,
									ent.getShortName(), this.stafferDao,
									this.idGenerator);
						}
					} catch (Exception arg19) {
						arg19.printStackTrace();
					}
				}

				msg = "保存成功！";
			} catch (NotAllowException arg21) {
				msg = arg21.getMessage();
			} catch (StockNoEnoughException arg22) {
				msg = arg22.getMessage();
			} catch (CannotAcquireLockException arg23) {
				msg = "事务冲突故障，请重新操作！";
			}

			mv.addObject("returnValue", billId);
			EncCommonHelper.setAlertMessage(request, msg);
			return mv;
		}
	}

	public ModelAndView handleCooCompBatch(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		if (!EncCommonHelper.checkPrivilege(request, "COOP_COMP")) {
			throw new Exception("Permission deny!");
		} else {
			String idStr = request.getParameter("id_str");
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
			List wcList = this.workCenterDao.getList(false);
			CodeRule obCr = this.codeRuleDao.get("OUT_BILL");
			List mtList = this.makeTypeDao.getList(false);
			String customTxt = "";
			boolean noCompOthe = false;
			boolean saFolComp = false;
			boolean saBusComp = false;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_COMP_OTHE")) {
				noCompOthe = true;
			}

			SmsAlert sa = this.smsAlertDao.get("BUS_COMPLETE");
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				saBusComp = true;
				customTxt = sa.getCustomTxt();
			}

			sa = this.smsAlertDao.get("FOL_COMP");
			Object saFolRecList = new ArrayList();
			if (sa != null && sa.getStatus() != null
					&& sa.getStatus().equals("Y")) {
				saFolComp = true;
				saFolRecList = this.smsAlertDao.getReceiverList(sa.getId());
			}

			String msg = "";
			if (idStr != null && !idStr.equals("")) {
				String[] idArr = idStr.split(";");

				for (int i = 0; i < idArr.length; ++i) {
					try {
						Map w = this.businessBillService.txCooComplete(
								Long.parseLong(idArr[i]), (String) null, obCr,
								wcList, mtList, ub, noCompOthe,
								this.businessBillDao, this.businessBillItemDao,
								this.outBillDao, this.stockDao,
								this.stockBalanceDao, this.serialNumberDao,
								this.idGenerator);
						if (w.get("comp") != null) {
							try {
								if (saFolComp) {
									PageHelper.sendFolCompMsg(w, ub,
											(List) saFolRecList,
											this.stafferDao, this.idGenerator);
								}
							} catch (Exception arg21) {
								arg21.printStackTrace();
							}

							try {
								if (saBusComp) {
									PageHelper.sendBusCompSms(w, customTxt,
											ent.getShortName(),
											this.stafferDao, this.idGenerator);
								}
							} catch (Exception arg20) {
								arg20.printStackTrace();
							}
						}

						msg = "保存成功！";
					} catch (NotAllowException arg22) {
						msg = arg22.getMessage();
					} catch (StockNoEnoughException arg23) {
						msg = arg23.getMessage();
					} catch (CannotAcquireLockException arg24) {
						msg = "事务冲突故障，只完成部分单据的完工操作，未完成的单据请重新操作！";
						break;
					}
				}

				mv.addObject("returnValue", String.valueOf(idArr.length));
				EncCommonHelper.setAlertMessage(request, msg);
			}

			return mv;
		}
	}

	public ModelAndView handleCooUnComp(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		if (!EncCommonHelper.checkPrivilege(request, "COOP_UN_COMP")) {
			throw new Exception("Permission deny!");
		} else {
			String itemIdStr = request.getParameter("item_id_str");
			String billId = request.getParameter("bill_id");
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);

			String msg;
			try {
				this.businessBillService.txCooUnComplete(
						Long.parseLong(billId), itemIdStr, ub,
						this.businessBillDao, this.businessBillItemDao,
						this.outBillDao, this.outBillItemDao, this.stockDao,
						this.stockBalanceDao, this.idGenerator);
				msg = "保存成功！";
			} catch (CannotAcquireLockException arg8) {
				msg = "事务冲突故障，请重新操作！";
			}

			mv.addObject("returnValue", billId);
			EncCommonHelper.setAlertMessage(request, msg);
			return mv;
		}
	}

	public ModelAndView handleListForCooper(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_COOP")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForCooperView);
			String searchType = request.getParameter("search_type");
			String estName = "";
			String billCode = "";
			String follName = "";
			String orderBy = "";
			String orderSc = "";
			long mngId = 0L;
			long tsId = 0L;
			Date orderStart = null;
			Date orderEnd = null;
			Date deliStart = null;
			Date deliEnd = null;
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("delStart", request.getParameter("del_start"));
			mv.addObject("delEnd", request.getParameter("del_end"));
			mv.addObject("estName", request.getParameter("est_name"));
			mv.addObject("billCode", request.getParameter("bill_code"));
			mv.addObject("follName", request.getParameter("foll_name"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			mv.addObject("orderBy", request.getParameter("order_by"));
			mv.addObject("orderSc", request.getParameter("order_sc"));
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				mngId = ub.getStaffer().getId();
			}

			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					billCode = request.getParameter("bill_code");
					if (allowStart != null) {
						orderStart = allowStart;
					}
				} else {
					String total = request.getParameter("cb_order_date");
					String perPageNum = request.getParameter("cb_del_date");
					String pageno = request.getParameter("cb_est");
					String startIndex = request.getParameter("cb_bill_code");
					String list = request.getParameter("cb_foll");
					String cbTs = request.getParameter("cb_ts");
					String cbOrder = request.getParameter("cb_order");
					SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
					if (total != null && total.equals("1")) {
						orderStart = sf.parse(request
								.getParameter("start_date"));
						orderEnd = sf
								.parse(EncCommonHelper.getNextDateStr(
										request.getParameter("end_date"),
										"yyyy-MM-dd"));
						if (allowStart != null && allowStart.after(orderStart)) {
							orderStart = allowStart;
						}

						mv.addObject("cbOrderDate", total);
					} else if (allowStart != null) {
						orderStart = allowStart;
					}

					if (perPageNum != null && perPageNum.equals("1")) {
						deliStart = sf.parse(request.getParameter("del_start"));
						deliEnd = sf.parse(EncCommonHelper.getNextDateStr(
								request.getParameter("del_end"), "yyyy-MM-dd"));
						mv.addObject("cbDelDate", perPageNum);
					}

					if (pageno != null && pageno.equals("1")) {
						estName = request.getParameter("est_name");
						mv.addObject("cbEst", pageno);
					}

					if (startIndex != null && startIndex.equals("1")) {
						billCode = request.getParameter("bill_code");
						mv.addObject("cbBillCode", startIndex);
					}

					if (list != null && list.equals("1")) {
						follName = request.getParameter("foll_name");
						mv.addObject("cbFoll", list);
					}

					if (cbTs != null && cbTs.equals("1")) {
						tsId = Long.parseLong(request.getParameter("ts_id"));
						mv.addObject("cbTs", cbTs);
					}

					if (cbOrder != null && cbOrder.equals("1")) {
						orderBy = request.getParameter("order_by");
						orderSc = request.getParameter("order_sc");
						mv.addObject("cbOrder", cbOrder);
					}
				}
			} else {
				searchType = "1";
				if (allowStart != null) {
					orderStart = allowStart;
				}
			}

			mv.addObject("searchType", searchType);
			int total1 = this.businessBillDao.getListForCooperCount(orderStart,
					orderEnd, deliStart, deliEnd, estName, billCode, follName,
					tsId, ub, mngId);
			int perPageNum1 = EncCommonHelper.getPageSize(request);
			int pageno1 = EncCommonHelper.getCurrentPageIndex(request, total1,
					perPageNum1);
			int startIndex1 = (pageno1 - 1) * perPageNum1;
			List list1 = this.businessBillDao
					.getListForCooper(orderStart, orderEnd, deliStart, deliEnd,
							estName, billCode, follName, tsId, ub, mngId,
							orderBy, orderSc, startIndex1, perPageNum1);
			mv.addObject("qr", EncCommonHelper.parseQueryResult(list1, total1,
					perPageNum1, pageno1));
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, ub));
			return mv;
		}
	}

	public ModelAndView handleReceivableCount(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "UN_RECE_COUN")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.receivableCountView);
			String year = request.getParameter("year");
			String tsId = request.getParameter("ts_id");
			Date now = new Date();
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			SimpleDateFormat yearSf = new SimpleDateFormat("yyyy");
			String currentYear = yearSf.format(now);
			if (year == null || year.equals("")) {
				year = currentYear;
			}

			Date startDate = sf.parse(year + "-01-01");
			Calendar c = Calendar.getInstance();
			c.setTime(startDate);
			c.add(1, 1);
			Date endDate = c.getTime();
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			if (tsId == null || tsId.equals("")) {
				tsId = String.valueOf(ub.getUser().getDfTsId());
			}

			long managerId = 0L;
			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				managerId = ub.getStaffer().getId();
			}

			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			List list = this.businessBillDao.getMonthCost(startDate, endDate,
					Long.parseLong(tsId), ub, managerId, allowStart);
			ArrayList arr = new ArrayList();
			Object[] totalObjs = new Object[]{"0", "0", "0", "0"};

			for (int i = 1; i <= 12; ++i) {
				Object[] objs = new Object[]{"0", "0", "0", "0"};

				for (int j = 0; j < list.size(); ++j) {
					Object[] tmpObjs = (Object[]) list.get(j);
					if (i == Integer.parseInt(tmpObjs[0].toString())) {
						BigDecimal cost = new BigDecimal(tmpObjs[1].toString());
						BigDecimal adjCost = new BigDecimal(
								tmpObjs[2].toString());
						BigDecimal recCost = new BigDecimal(
								tmpObjs[3].toString());
						BigDecimal remainCost = cost.add(adjCost).subtract(
								recCost);
						objs[0] = tmpObjs[1];
						objs[1] = tmpObjs[2];
						objs[2] = tmpObjs[3];
						objs[3] = remainCost;
						totalObjs[0] = (new BigDecimal(totalObjs[0].toString()))
								.add(cost).toString();
						totalObjs[1] = (new BigDecimal(totalObjs[1].toString()))
								.add(adjCost).toString();
						totalObjs[2] = (new BigDecimal(totalObjs[2].toString()))
								.add(recCost).toString();
						totalObjs[3] = (new BigDecimal(totalObjs[3].toString()))
								.add(remainCost).toString();
						break;
					}
				}

				arr.add(objs);
			}

			mv.addObject("list", arr);
			mv.addObject("totalList", totalObjs);
			mv.addObject("year", year);
			mv.addObject("tsId", tsId);
			mv.addObject("currentYear", currentYear);
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, ub));
			return mv;
		}
	}

	public ModelAndView handleRelBillList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.relBillListView);
		String code = request.getParameter("code");
		if (code != null && !code.equals("")) {
			BusinessBill bill = this.businessBillDao.get(code);
			if (bill != null) {
				long id = bill.getId();
				mv.addObject("bill", bill);
				mv.addObject(
						"billExt",
						this.businessBillDao.get(BusinessBillExt.class,
								bill.getId()));
				mv.addObject("accList", this.accessoryDao.getList(
						"BUSINESS_BILL", id, (String[]) null, 0L));
				mv.addObject("dlList", this.accessoryDao.getDownloadLogList(
						"BUSINESS_BILL", id));
				mv.addObject("deliverList",
						this.deliverBillDao.getListByBusinessBill(id));
				mv.addObject("setuList",
						this.setuBillDao.getListByBusinessBill(id));
				mv.addObject("receiveList",
						this.receiveBillDao.getListByBusinessBill(id));
				mv.addObject("adjustList",
						this.adjustBillDao.getList("BUSINESS_BILL", id));
				mv.addObject("cooperList",
						this.cooperBillDao.getListByBusinessBill(id));
				mv.addObject("gatherList",
						this.cooperBillDao.getGathListByBusinessBill(id));
				mv.addObject("outList",
						this.outBillDao.getListByBusinessBill(code));
				mv.addObject("feeList",
						this.feeBillDao.getListForBusinessBill(id, false));
				mv.addObject("workCenterList",
						this.workCenterDao.getList(false));
				mv.addObject("proList", this.workProcessDao.getList(0L, false));
				mv.addObject("businessLogList",
						this.businessUpdateLogDao.getList(id));
				mv.addObject("msgList", this.messageDao.getRelationList(id));
				List itemList = this.businessBillItemDao.getListWidthExt(id);
				List makeTypeList = this.makeTypeDao.getList(false);
				ArrayList arr = new ArrayList();

				for (int i = 0; i < itemList.size(); ++i) {
					BusinessBillItemBean bean = new BusinessBillItemBean();
					Object[] objs = (Object[]) itemList.get(i);
					bean.setBusinessBillItem((BusinessBillItem) objs[0]);
					bean.setBusinessBillItemExt((BusinessBillItemExt) objs[1]);
					bean.setMakeTypeName(EncCommonHelper.getSimpleObjectName(
							makeTypeList, bean.getBusinessBillItem()
									.getMakeTypeId()));
					arr.add(bean);
				}

				mv.addObject("itemList", arr);
				mv.addObject("printList",
						this.printLogDao.getList("BUSINESS_BILL", id));
			}
		}

		return mv;
	}

	public ModelAndView handleRelBillCancel(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.relBillCancelView);
		long id = Long.parseLong(request.getParameter("id"));
		String code = request.getParameter("code");
		mv.addObject("deliverList",
				this.deliverBillDao.getListByBusinessBill(id));
		mv.addObject("receiveList",
				this.receiveBillDao.getListByBusinessBill(id));
		mv.addObject("adjustList",
				this.adjustBillDao.getList("BUSINESS_BILL", id));
		mv.addObject("setuList", this.setuBillDao.getListByBusinessBill(id));
		mv.addObject("code", code);
		return mv;
	}

	public ModelAndView handleMake(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		String billIdStr = request.getParameter("bill_id");
		String wcIdStr = request.getParameter("wc_id");
		boolean saProMake = false;
		SmsAlert sa = this.smsAlertDao.get("PRO_MAKE");
		if (sa != null && sa.getStatus() != null && sa.getStatus().equals("Y")) {
			saProMake = true;
		}

		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
		String msg = "";

		try {
			String[] w = billIdStr.split(";");
			String[] wcIdArr = wcIdStr.split(";");
			List proList = this.workProcessDao.getList(0L, true);
			List mtList = this.makeTypeDao.getList(false);

			for (int i = 0; i < w.length; ++i) {
				Map map = this.businessBillService.txMake(Long.parseLong(w[i]),
						Long.parseLong(wcIdArr[i]), ub, proList, mtList,
						this.businessBillItemDao, this.idGenerator);
				String status = (String) map.get("status");
				if (status.equals("ERROR")) {
					if (!msg.equals("")) {
						msg = msg + "<br>";
					}

					msg = msg + map.get("msg");
				} else {
					try {
						if (map.get("makeMsg") != null && saProMake) {
							long me = ((Long) map.get("billId")).longValue();
							long depId = ((Long) map.get("depId")).longValue();
							long estId = ((Long) map.get("estId")).longValue();
							Date deliDate = (Date) map.get("deliDate");
							String billCode = (String) map.get("billCode");
							String msgContent = (String) map.get("msgContent");
							Establishment est = (Establishment) this.stafferDao
									.get(Establishment.class, estId);
							String estName = "";
							if (est != null) {
								estName = est.getEstName();
							}

							String msgTitle = estName + billCode;
							if (deliDate != null) {
								msgTitle = msgTitle + "交货日期"
										+ sf.format(deliDate);
							}

							msgTitle = msgTitle + "已开工";
							List staList = this.stafferDao.getList(depId, true,
									false, "", "");
							PageHelper.sendMessage(msgTitle, msgContent, me,
									ub, staList, this.stafferDao,
									this.idGenerator);
						}
					} catch (Exception arg30) {
						arg30.printStackTrace();
					}
				}
			}

			if (msg.equals("")) {
				msg = "保存成功！";
			}
		} catch (NotAllowException arg31) {
			msg = arg31.getMessage();
		} catch (CannotAcquireLockException arg32) {
			msg = "事务冲突故障，请重新操作！";
		}

		mv.addObject("returnValue", "ok");
		EncCommonHelper.setAlertMessage(request, msg);
		return mv;
	}

	public ModelAndView handleUnMake(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		String billIdStr = request.getParameter("bill_id");
		String wcIdStr = request.getParameter("wc_id");
		String msg = "";

		try {
			String[] w = billIdStr.split(";");
			String[] wcIdArr = wcIdStr.split(";");

			for (int i = 0; i < w.length; ++i) {
				msg = this.businessBillService.txUnMake(Long.parseLong(w[i]),
						Long.parseLong(wcIdArr[i]), ub,
						this.businessBillItemDao);
			}
		} catch (NotAllowException arg10) {
			msg = arg10.getMessage();
		} catch (CannotAcquireLockException arg11) {
			msg = "事务冲突故障，请重新操作！";
		}

		mv.addObject("returnValue", "ok");
		EncCommonHelper.setAlertMessage(request, msg);
		return mv;
	}

	public ModelAndView handleEstBusinessCount(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "CLIE_BUSI_COUN")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.estBusinessCountView);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			String contentType = request.getParameter("content_type");
			String searchType = request.getParameter("search_type");
			long estId = 0L;
			long areaId = 0L;
			long etId = 0L;
			long elId = 0L;
			long tsId = 0L;
			long mngId = 0L;
			Date startDate = null;
			Date endDate = null;
			BigDecimal maxCost = null;
			BigDecimal minCost = null;
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			mv.addObject("estName", request.getParameter("est_name"));
			mv.addObject("estId", request.getParameter("est_id"));
			mv.addObject("areaId", request.getParameter("area_id"));
			mv.addObject("etId", request.getParameter("et_id"));
			mv.addObject("elId", request.getParameter("el_id"));
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			mv.addObject("maxCost", request.getParameter("max_cost"));
			mv.addObject("minCost", request.getParameter("min_cost"));
			mv.addObject("mngName", request.getParameter("mng_name"));
			mv.addObject("mngId", request.getParameter("mng_id"));
			long managerId = 0L;
			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				managerId = ub.getStaffer().getId();
			}

			Date now = new Date();
			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					startDate = sf.parse(request.getParameter("start_date"));
					if (allowStart != null && allowStart.after(startDate)) {
						startDate = allowStart;
					}

					endDate = sf.parse(EncCommonHelper.getNextDateStr(
							request.getParameter("end_date"), "yyyy-MM-dd"));
					mngId = managerId;
				} else {
					String list = request.getParameter("cb_order_date");
					String costTotal = request.getParameter("cb_area");
					String favTotal = request.getParameter("cb_et");
					String adjTotal = request.getParameter("cb_el");
					String recTotal = request.getParameter("cb_est");
					String remTotal = request.getParameter("cb_ts");
					String total = request.getParameter("cb_cost");
					String perPageNum = request.getParameter("cb_mng");
					if (list != null && list.equals("1")) {
						startDate = sf
								.parse(request.getParameter("start_date"));
						if (allowStart != null && allowStart.after(startDate)) {
							startDate = allowStart;
						}

						endDate = sf
								.parse(EncCommonHelper.getNextDateStr(
										request.getParameter("end_date"),
										"yyyy-MM-dd"));
						mv.addObject("cbOrderDate", list);
					} else if (allowStart != null) {
						startDate = allowStart;
					}

					if (costTotal != null && costTotal.equals("1")) {
						areaId = Long
								.parseLong(request.getParameter("area_id"));
						mv.addObject("cbArea", costTotal);
					}

					if (favTotal != null && favTotal.equals("1")) {
						etId = Long.parseLong(request.getParameter("et_id"));
						mv.addObject("cbEt", favTotal);
					}

					if (adjTotal != null && adjTotal.equals("1")) {
						elId = Long.parseLong(request.getParameter("el_id"));
						mv.addObject("cbEl", adjTotal);
					}

					if (recTotal != null && recTotal.equals("1")) {
						estId = Long.parseLong(request.getParameter("est_id"));
						mv.addObject("cbEst", recTotal);
					}

					if (remTotal != null && remTotal.equals("1")) {
						tsId = Long.parseLong(request.getParameter("ts_id"));
						mv.addObject("cbTs", remTotal);
					}

					if (total != null && total.equals("1")) {
						maxCost = new BigDecimal(
								request.getParameter("max_cost"));
						minCost = new BigDecimal(
								request.getParameter("min_cost"));
						mv.addObject("cbCost", total);
					}

					if (perPageNum != null && perPageNum.equals("1")) {
						mngId = Long.parseLong(request.getParameter("mng_id"));
						if (managerId != 0L && mngId != managerId) {
							mngId = -2L;
						}

						mv.addObject("cbMng", perPageNum);
					} else {
						mngId = managerId;
					}
				}
			} else {
				searchType = "1";
				startDate = now;
				endDate = sf.parse(EncCommonHelper.getNextDateStr(
						sf.format(now), "yyyy-MM-dd"));
				if (allowStart != null && allowStart.after(now)) {
					startDate = allowStart;
				}

				mv.addObject("startDate", sf.format(now));
				mv.addObject("endDate", sf.format(now));
				mv.addObject("cbOrderDate", "1");
				tsId = ub.getUser().getDfTsId();
				mv.addObject("tsId", String.valueOf(tsId));
				mv.addObject("cbTs", "1");
				mngId = managerId;
			}

			List list1 = this.businessBillDao.getEstBusinessCountTotal(
					startDate, endDate, estId, areaId, etId, elId, mngId, tsId,
					ub, minCost, maxCost);
			BigDecimal costTotal1 = new BigDecimal(0);
			BigDecimal favTotal1 = new BigDecimal(0);
			BigDecimal adjTotal1 = new BigDecimal(0);
			BigDecimal recTotal1 = new BigDecimal(0);
			new BigDecimal(0);
			int total1 = 0;
			if (!list1.isEmpty() && list1.get(0) != null) {
				Object[] perPageNum1 = (Object[]) list1.get(0);
				if (perPageNum1[0] != null) {
					total1 = Integer.parseInt(perPageNum1[0].toString());
				}

				if (perPageNum1[1] != null) {
					costTotal1 = new BigDecimal(perPageNum1[1].toString());
					favTotal1 = new BigDecimal(perPageNum1[2].toString());
					adjTotal1 = new BigDecimal(perPageNum1[3].toString());
					recTotal1 = new BigDecimal(perPageNum1[4].toString());
				}
			}

			BigDecimal remTotal1 = costTotal1.add(adjTotal1)
					.subtract(recTotal1);
			if (contentType != null && contentType.equals("EXCEL")) {
				list1 = this.businessBillDao.getEstBusinessCountList(startDate,
						endDate, estId, areaId, etId, elId, mngId, tsId, ub,
						minCost, maxCost, 0, total1);
				HashMap perPageNum3 = new HashMap();
				perPageNum3.put("list", list1);
				perPageNum3.put("costTotal", costTotal1);
				perPageNum3.put("favTotal", favTotal1);
				perPageNum3.put("adjTotal", adjTotal1);
				perPageNum3.put("recTotal", recTotal1);
				perPageNum3.put("remTotal", remTotal1);
				perPageNum3.put("estTypeList",
						this.establishmentTypeDao.getList(false));
				perPageNum3.put("estLevelList",
						this.establishmentLevelDao.getList(false));
				perPageNum3.put("areaList", this.areaDao.getList(false));
				EstBusinessCountExcelView pageno1 = new EstBusinessCountExcelView();
				return new ModelAndView(pageno1, perPageNum3);
			} else {
				int perPageNum2 = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						total1, perPageNum2);
				int startIndex = (pageno - 1) * perPageNum2;
				list1 = this.businessBillDao.getEstBusinessCountList(startDate,
						endDate, estId, areaId, etId, elId, mngId, tsId, ub,
						minCost, maxCost, startIndex, perPageNum2);
				mv.addObject("qr", EncCommonHelper.parseQueryResult(list1,
						total1, perPageNum2, pageno));
				mv.addObject("costTotal", costTotal1);
				mv.addObject("favTotal", favTotal1);
				mv.addObject("adjTotal", adjTotal1);
				mv.addObject("recTotal", recTotal1);
				mv.addObject("remTotal", remTotal1);
				mv.addObject("estTypeList",
						this.establishmentTypeDao.getList(false));
				mv.addObject("estLevelList",
						this.establishmentLevelDao.getList(false));
				mv.addObject("areaList", this.areaDao.getList(false));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				mv.addObject("searchType", searchType);
				return mv;
			}
		}
	}

	public ModelAndView handleEstBackCount(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "CLIE_BACK_COUN")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.estBackCountView);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			String contentType = request.getParameter("content_type");
			String searchType = request.getParameter("search_type");
			long estId = 0L;
			long areaId = 0L;
			long etId = 0L;
			long elId = 0L;
			long tsId = 0L;
			long mngId = 0L;
			Date startDate = null;
			Date endDate = null;
			BigDecimal maxCost = null;
			BigDecimal minCost = null;
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			mv.addObject("estName", request.getParameter("est_name"));
			mv.addObject("estId", request.getParameter("est_id"));
			mv.addObject("areaId", request.getParameter("area_id"));
			mv.addObject("etId", request.getParameter("et_id"));
			mv.addObject("elId", request.getParameter("el_id"));
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			mv.addObject("maxCost", request.getParameter("max_cost"));
			mv.addObject("minCost", request.getParameter("min_cost"));
			mv.addObject("mngName", request.getParameter("mng_name"));
			mv.addObject("mngId", request.getParameter("mng_id"));
			long managerId = 0L;
			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				managerId = ub.getStaffer().getId();
			}

			Date now = new Date();
			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					startDate = sf.parse(request.getParameter("start_date"));
					if (allowStart != null && allowStart.after(startDate)) {
						startDate = allowStart;
					}

					endDate = sf.parse(EncCommonHelper.getNextDateStr(
							request.getParameter("end_date"), "yyyy-MM-dd"));
					mngId = managerId;
				} else {
					String list = request.getParameter("cb_order_date");
					String costTotal = request.getParameter("cb_area");
					String impTotal = request.getParameter("cb_et");
					String recTotal = request.getParameter("cb_el");
					String total = request.getParameter("cb_est");
					String perPageNum = request.getParameter("cb_ts");
					String pageno = request.getParameter("cb_cost");
					String startIndex = request.getParameter("cb_mng");
					if (list != null && list.equals("1")) {
						startDate = sf
								.parse(request.getParameter("start_date"));
						if (allowStart != null && allowStart.after(startDate)) {
							startDate = allowStart;
						}

						endDate = sf
								.parse(EncCommonHelper.getNextDateStr(
										request.getParameter("end_date"),
										"yyyy-MM-dd"));
						mv.addObject("cbOrderDate", list);
					} else if (allowStart != null) {
						startDate = allowStart;
					}

					if (costTotal != null && costTotal.equals("1")) {
						areaId = Long
								.parseLong(request.getParameter("area_id"));
						mv.addObject("cbArea", costTotal);
					}

					if (impTotal != null && impTotal.equals("1")) {
						etId = Long.parseLong(request.getParameter("et_id"));
						mv.addObject("cbEt", impTotal);
					}

					if (recTotal != null && recTotal.equals("1")) {
						elId = Long.parseLong(request.getParameter("el_id"));
						mv.addObject("cbEl", recTotal);
					}

					if (total != null && total.equals("1")) {
						estId = Long.parseLong(request.getParameter("est_id"));
						mv.addObject("cbEst", total);
					}

					if (perPageNum != null && perPageNum.equals("1")) {
						tsId = Long.parseLong(request.getParameter("ts_id"));
						mv.addObject("cbTs", perPageNum);
					}

					if (pageno != null && pageno.equals("1")) {
						maxCost = new BigDecimal(
								request.getParameter("max_cost"));
						minCost = new BigDecimal(
								request.getParameter("min_cost"));
						mv.addObject("cbCost", pageno);
					}

					if (startIndex != null && startIndex.equals("1")) {
						mngId = Long.parseLong(request.getParameter("mng_id"));
						if (managerId != 0L && mngId != managerId) {
							mngId = -2L;
						}

						mv.addObject("cbMng", startIndex);
					} else {
						mngId = managerId;
					}
				}
			} else {
				searchType = "1";
				startDate = now;
				endDate = sf.parse(EncCommonHelper.getNextDateStr(
						sf.format(now), "yyyy-MM-dd"));
				if (allowStart != null && allowStart.after(now)) {
					startDate = allowStart;
				}

				mv.addObject("startDate", sf.format(now));
				mv.addObject("endDate", sf.format(now));
				mv.addObject("cbOrderDate", "1");
				tsId = ub.getUser().getDfTsId();
				mv.addObject("tsId", String.valueOf(tsId));
				mv.addObject("cbTs", "1");
				mngId = managerId;
			}

			List list1 = this.financeDetailDao.getEstBackCountTotal(startDate,
					endDate, estId, areaId, etId, elId, mngId, tsId, ub,
					minCost, maxCost);
			BigDecimal costTotal1 = new BigDecimal(0);
			BigDecimal impTotal1 = new BigDecimal(0);
			BigDecimal recTotal1 = new BigDecimal(0);
			int total1 = 0;
			if (!list1.isEmpty() && list1.get(0) != null) {
				Object[] perPageNum1 = (Object[]) list1.get(0);
				if (perPageNum1[0] != null) {
					total1 = Integer.parseInt(perPageNum1[0].toString());
				}

				if (perPageNum1[1] != null) {
					impTotal1 = new BigDecimal(perPageNum1[1].toString());
					recTotal1 = new BigDecimal(perPageNum1[2].toString());
					costTotal1 = new BigDecimal(perPageNum1[3].toString());
				}
			}

			if (contentType != null && contentType.equals("EXCEL")) {
				list1 = this.financeDetailDao.getEstBackCountList(startDate,
						endDate, estId, areaId, etId, elId, mngId, tsId, ub,
						minCost, maxCost, 0, total1);
				HashMap perPageNum3 = new HashMap();
				perPageNum3.put("list", list1);
				perPageNum3.put("costTotal", costTotal1);
				perPageNum3.put("impTotal", impTotal1);
				perPageNum3.put("recTotal", recTotal1);
				perPageNum3.put("estTypeList",
						this.establishmentTypeDao.getList(false));
				perPageNum3.put("estLevelList",
						this.establishmentLevelDao.getList(false));
				perPageNum3.put("areaList", this.areaDao.getList(false));
				EstBackCountExcelView pageno2 = new EstBackCountExcelView();
				return new ModelAndView(pageno2, perPageNum3);
			} else {
				int perPageNum2 = EncCommonHelper.getPageSize(request);
				int pageno1 = EncCommonHelper.getCurrentPageIndex(request,
						total1, perPageNum2);
				int startIndex1 = (pageno1 - 1) * perPageNum2;
				list1 = this.financeDetailDao.getEstBackCountList(startDate,
						endDate, estId, areaId, etId, elId, mngId, tsId, ub,
						minCost, maxCost, startIndex1, perPageNum2);
				mv.addObject("qr", EncCommonHelper.parseQueryResult(list1,
						total1, perPageNum2, pageno1));
				mv.addObject("costTotal", costTotal1);
				mv.addObject("impTotal", impTotal1);
				mv.addObject("recTotal", recTotal1);
				mv.addObject("estTypeList",
						this.establishmentTypeDao.getList(false));
				mv.addObject("estLevelList",
						this.establishmentLevelDao.getList(false));
				mv.addObject("areaList", this.areaDao.getList(false));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				mv.addObject("searchType", searchType);
				return mv;
			}
		}
	}

	public ModelAndView handleBusinessDateCount(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_DATE_COUN")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			Date startDate = null;
			Date endDate = null;
			long tsId = 0L;
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			String startDateStr = request.getParameter("start_date");
			String endDateStr = request.getParameter("end_date");
			String tsIdStr = request.getParameter("ts_id");
			String contentType = request.getParameter("content_type");
			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			if (startDateStr != null && !startDateStr.equals("")) {
				startDate = sf.parse(startDateStr);
				endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
						"yyyy-MM-dd"));
			} else {
				Date mv = new Date();
				startDateStr = sf.format(mv);
				endDateStr = sf.format(mv);
				startDate = mv;
				endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
						"yyyy-MM-dd"));
				tsIdStr = String.valueOf(ub.getUser().getDfTsId());
			}

			if (allowStart != null && allowStart.after(startDate)) {
				startDate = allowStart;
			}

			if (tsIdStr != null && !tsIdStr.equals("")) {
				tsId = Long.parseLong(tsIdStr);
			}

			ModelAndView mv1;
			if (contentType != null && contentType.equals("PRINT")) {
				mv1 = new ModelAndView(this.businessDateCountPrintView);
				mv1.addObject("currentTime", new Date());
			} else {
				mv1 = new ModelAndView(this.businessDateCountView);
			}

			mv1.addObject("startDate", startDateStr);
			mv1.addObject("endDate", endDateStr);
			mv1.addObject("tsId", tsIdStr);
			BigDecimal recTotal = this.receiveBillDao.getBusinessDateCount(
					startDate, endDate, tsId, ub);
			BigDecimal salTotal = new BigDecimal(0);
			BigDecimal impTotal = new BigDecimal(0);
			new BigDecimal(0);
			new BigDecimal(0);
			String busCount = "0";
			List list = this.businessBillDao.getBusinessDateCount(startDate,
					endDate, tsId, ub);
			if (!list.isEmpty() && list.get(0) != null) {
				Object[] recCount = (Object[]) list.get(0);
				if (recCount[0] != null) {
					busCount = recCount[0].toString();
				}

				if (recCount[1] != null) {
					salTotal = new BigDecimal(recCount[1].toString());
				}

				if (recCount[2] != null) {
					impTotal = new BigDecimal(recCount[2].toString());
				}
			}

			BigDecimal busTotal = salTotal.subtract(impTotal);
			BigDecimal backTotal = recTotal.add(impTotal);
			int recCount1 = this.receiveBillDao.getBusinessDateCountNum(
					startDate, endDate, tsId, ub);
			int impCount = this.businessBillDao.getBusinessDateCountImpNum(
					startDate, endDate, tsId, ub);
			mv1.addObject("salTotal", salTotal);
			mv1.addObject("impTotal", impTotal);
			mv1.addObject("recTotal", recTotal);
			mv1.addObject("salTotal", salTotal);
			mv1.addObject("busTotal", busTotal);
			mv1.addObject("backTotal", backTotal);
			mv1.addObject("busCount", busCount);
			mv1.addObject("recCount", Integer.valueOf(recCount1));
			mv1.addObject("impCount", Integer.valueOf(impCount));
			mv1.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, ub));
			return mv1;
		}
	}

	public ModelAndView handleStafferExploitList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "STAF_EXPL")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.stafferExploitListView);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			Date startDate = null;
			Date endDate = null;
			long tsId = 0L;
			long staId = 0L;
			long depId = 0L;
			String orderBy = "";
			String orderSc = "";
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			SimpleDateFormat monthSf = new SimpleDateFormat("yyyy-MM");
			String contentType = request.getParameter("content_type");
			String searchType = request.getParameter("search_type");
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("staId", request.getParameter("sta_id"));
			mv.addObject("staName", request.getParameter("sta_name"));
			mv.addObject("depId", request.getParameter("dep_id"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			mv.addObject("orderBy", request.getParameter("order_by"));
			mv.addObject("orderSc", request.getParameter("order_sc"));
			Date now = new Date();
			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			String list;
			String v;
			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					startDate = sf.parse(request.getParameter("start_date"));
					if (allowStart != null && allowStart.after(startDate)) {
						startDate = allowStart;
					}

					endDate = sf.parse(EncCommonHelper.getNextDateStr(
							request.getParameter("end_date"), "yyyy-MM-dd"));
				} else {
					list = request.getParameter("cb_date");
					String map1 = request.getParameter("cb_sta");
					v = request.getParameter("cb_dep");
					String cbTs = request.getParameter("cb_ts");
					String cbOrder = request.getParameter("cb_order");
					if (list != null && list.equals("1")) {
						startDate = sf
								.parse(request.getParameter("start_date"));
						if (allowStart != null && allowStart.after(startDate)) {
							startDate = allowStart;
						}

						endDate = sf
								.parse(EncCommonHelper.getNextDateStr(
										request.getParameter("end_date"),
										"yyyy-MM-dd"));
						mv.addObject("cbDate", list);
					} else if (allowStart != null) {
						startDate = allowStart;
					}

					if (map1 != null && map1.equals("1")) {
						staId = Long.parseLong(request.getParameter("sta_id"));
						mv.addObject("cbSta", map1);
					}

					if (v != null && v.equals("1")) {
						depId = Long.parseLong(request.getParameter("dep_id"));
						mv.addObject("cbDep", v);
					}

					if (cbTs != null && cbTs.equals("1")) {
						tsId = Long.parseLong(request.getParameter("ts_id"));
						mv.addObject("cbTs", cbTs);
					}

					if (cbOrder != null && cbOrder.equals("1")) {
						orderBy = request.getParameter("order_by");
						orderSc = request.getParameter("order_sc");
						mv.addObject("cbOrder", cbOrder);
					}
				}
			} else {
				searchType = "1";
				list = monthSf.format(now) + "-01";
				startDate = sf.parse(list);
				Calendar map = Calendar.getInstance();
				map.setTime(startDate);
				map.add(2, 1);
				endDate = map.getTime();
				map.add(5, -1);
				v = sf.format(map.getTime());
				if (allowStart != null && allowStart.after(startDate)) {
					startDate = allowStart;
				}

				mv.addObject("startDate", list);
				mv.addObject("endDate", v);
				mv.addObject("cbDate", "1");
				tsId = ub.getUser().getDfTsId();
				mv.addObject("tsId", String.valueOf(tsId));
				mv.addObject("cbTs", "1");
			}

			List list1 = this.businessBillDao.getStafferExploitList(startDate,
					endDate, staId, depId, tsId, ub, orderBy, orderSc);
			if (contentType != null && contentType.equals("EXCEL")) {
				HashMap map2 = new HashMap();
				map2.put("list", list1);
				StafferExploitListExcelView v1 = new StafferExploitListExcelView();
				return new ModelAndView(v1, map2);
			} else {
				mv.addObject("list", list1);
				mv.addObject("depList", this.departmentDao.getList(true));
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				mv.addObject("searchType", searchType);
				return mv;
			}
		}
	}

	public ModelAndView handleSetStafferRate(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.setStafferRateView);
		String idStr = request.getParameter("id_str");
		String nameStr = request.getParameter("name_str");
		mv.addObject("idList", idStr.split(";"));
		mv.addObject("nameList", nameStr.split(";"));
		if (idStr.indexOf(";") == -1) {
			mv.addObject("defVal", "1");
		}

		mv.addObject("type", request.getParameter("type"));
		return mv;
	}

	public ModelAndView handleMtBusinessCount(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "MT_BUSI_COUN")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.mtBusinessCountView);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			String contentType = request.getParameter("content_type");
			String searchType = request.getParameter("search_type");
			long mtId = 0L;
			long estId = 0L;
			long tsId = 0L;
			String proName = "";
			String mngName = "";
			String desiName = "";
			String follName = "";
			String creaName = "";
			Date startDate = null;
			Date endDate = null;
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			mv.addObject("proName", request.getParameter("pro_name"));
			mv.addObject("mtId", request.getParameter("mt_id"));
			mv.addObject("startDate", request.getParameter("start_date"));
			mv.addObject("endDate", request.getParameter("end_date"));
			mv.addObject("estId", request.getParameter("est_id"));
			mv.addObject("estName", request.getParameter("est_name"));
			mv.addObject("mngName", request.getParameter("mng_name"));
			mv.addObject("desiName", request.getParameter("desi_name"));
			mv.addObject("follName", request.getParameter("foll_name"));
			mv.addObject("creaName", request.getParameter("crea_name"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			long managerId = 0L;
			if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
				managerId = ub.getStaffer().getId();
			}

			Date now = new Date();
			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					startDate = sf.parse(request.getParameter("start_date"));
					if (allowStart != null && allowStart.after(startDate)) {
						startDate = allowStart;
					}

					endDate = sf.parse(EncCommonHelper.getNextDateStr(
							request.getParameter("end_date"), "yyyy-MM-dd"));
				} else {
					String list = request.getParameter("cb_order_date");
					String costTotal = request.getParameter("cb_mt");
					String total = request.getParameter("cb_pro");
					String perPageNum = request.getParameter("cb_est");
					String pageno = request.getParameter("cb_mng");
					String startIndex = request.getParameter("cb_desi");
					String cbFoll = request.getParameter("cb_foll");
					String cbCrea = request.getParameter("cb_crea");
					String cbTs = request.getParameter("cb_ts");
					if (list != null && list.equals("1")) {
						startDate = sf
								.parse(request.getParameter("start_date"));
						if (allowStart != null && allowStart.after(startDate)) {
							startDate = allowStart;
						}

						endDate = sf
								.parse(EncCommonHelper.getNextDateStr(
										request.getParameter("end_date"),
										"yyyy-MM-dd"));
						mv.addObject("cbOrderDate", list);
					} else if (allowStart != null) {
						startDate = allowStart;
					}

					if (costTotal != null && costTotal.equals("1")) {
						mtId = Long.parseLong(request.getParameter("mt_id"));
						mv.addObject("cbMt", costTotal);
					}

					if (total != null && total.equals("1")) {
						proName = request.getParameter("pro_name");
						mv.addObject("cbPro", total);
					}

					if (perPageNum != null && perPageNum.equals("1")) {
						estId = Long.parseLong(request.getParameter("est_id"));
						mv.addObject("cbEst", perPageNum);
					}

					if (pageno != null && pageno.equals("1")) {
						mngName = request.getParameter("mng_name");
						mv.addObject("cbMng", pageno);
					}

					if (startIndex != null && startIndex.equals("1")) {
						desiName = request.getParameter("desi_name");
						mv.addObject("cbDesi", startIndex);
					}

					if (cbFoll != null && cbFoll.equals("1")) {
						follName = request.getParameter("foll_name");
						mv.addObject("cbFoll", cbFoll);
					}

					if (cbCrea != null && cbCrea.equals("1")) {
						creaName = request.getParameter("crea_name");
						mv.addObject("cbCrea", cbCrea);
					}

					if (cbTs != null && cbTs.equals("1")) {
						tsId = Long.parseLong(request.getParameter("ts_id"));
						mv.addObject("cbTs", cbTs);
					}
				}
			} else {
				searchType = "1";
				startDate = now;
				endDate = sf.parse(EncCommonHelper.getNextDateStr(
						sf.format(now), "yyyy-MM-dd"));
				mv.addObject("startDate", sf.format(now));
				mv.addObject("endDate", sf.format(now));
				mv.addObject("cbOrderDate", "1");
				if (allowStart != null && allowStart.after(now)) {
					startDate = allowStart;
				}

				tsId = ub.getUser().getDfTsId();
				mv.addObject("tsId", String.valueOf(tsId));
				mv.addObject("cbTs", "1");
			}

			List list1 = this.businessBillDao.getMtBusinessCountTotal(
					startDate, endDate, mtId, proName, estId, mngName,
					desiName, follName, creaName, managerId, tsId, ub);
			BigDecimal costTotal1 = new BigDecimal(0);
			int total1 = 0;
			if (!list1.isEmpty() && list1.get(0) != null) {
				Object[] perPageNum1 = (Object[]) list1.get(0);
				if (perPageNum1[0] != null) {
					total1 = Integer.parseInt(perPageNum1[0].toString());
				}

				if (perPageNum1[1] != null) {
					costTotal1 = (BigDecimal) perPageNum1[1];
				}
			}

			if (contentType != null && contentType.equals("EXCEL")) {
				list1 = this.businessBillDao.getMtBusinessCountList(startDate,
						endDate, mtId, proName, estId, mngName, desiName,
						follName, creaName, managerId, tsId, ub, 0, total1);
				this.parseMtBusinessCount(list1);
				HashMap perPageNum3 = new HashMap();
				perPageNum3.put("list", list1);
				perPageNum3.put("costTotal", costTotal1);
				MtBusinessCountExcelView pageno2 = new MtBusinessCountExcelView();
				return new ModelAndView(pageno2, perPageNum3);
			} else {
				int perPageNum2 = EncCommonHelper.getPageSize(request);
				int pageno1 = EncCommonHelper.getCurrentPageIndex(request,
						total1, perPageNum2);
				int startIndex1 = (pageno1 - 1) * perPageNum2;
				list1 = this.businessBillDao.getMtBusinessCountList(startDate,
						endDate, mtId, proName, estId, mngName, desiName,
						follName, creaName, managerId, tsId, ub, startIndex1,
						perPageNum2);
				this.parseMtBusinessCount(list1);
				mv.addObject("qr", EncCommonHelper.parseQueryResult(list1,
						total1, perPageNum2, pageno1));
				mv.addObject("costTotal", costTotal1);
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				mv.addObject("makeTypeList", this.makeTypeDao.getList(true));
				mv.addObject("searchType", searchType);
				return mv;
			}
		}
	}

	private void parseMtBusinessCount(List list) {
		BigDecimal zero = new BigDecimal(0);

		for (int i = 0; i < list.size(); ++i) {
			Object[] objs = (Object[]) list.get(i);
			String priceType = (String) objs[6];
			String lengType = (String) objs[11];
			if (priceType.equals("AMOUNT")) {
				objs[3] = objs[7];
			} else {
				objs[3] = objs[8];
				if (priceType.equals("AREA")) {
					objs[2] = "平方米";
				} else if (lengType.equals("M")) {
					objs[2] = "米";
				} else {
					objs[2] = "公分";
				}
			}

			BigDecimal amount = (BigDecimal) objs[3];
			BigDecimal cost = (BigDecimal) objs[5];
			if (amount.compareTo(zero) != 0) {
				objs[4] = cost.divide(amount, 3, 4);
			} else {
				objs[4] = new BigDecimal(0);
			}
		}

	}

	public ModelAndView handleBusinessLogList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_LOG")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.businessLogListView);
			String contentType = request.getParameter("content_type");
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleBusinessLogList(request, this.dataSource);
			if (contentType != null && contentType.equals("EXCEL")) {
				HashMap qr1 = new HashMap();
				QueryResult ub1 = this.queryDao.doQuery(b.getQParas(),
						b.getOParas(), (String[]) null, b.getShortNameMap(),
						b.getRetObjs(), (String[]) null);
				qr1.put("list", ub1.getList());
				BusinessLogListExcelView v = new BusinessLogListExcelView();
				return new ModelAndView(v, qr1);
			} else {
				QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
						b.getPageSize(), b.getQParas(), b.getOParas(),
						(String[]) null, b.getShortNameMap(), b.getRetObjs(),
						(String[]) null);
				mv.addAllObjects(b.getParameters());
				mv.addObject("qr", qr);
				mv.addObject("departmentList", this.departmentDao.getList(true));
				UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				return mv;
			}
		}
	}

	public ModelAndView handleUrgent(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		String billId = request.getParameter("bill_id");
		String wcId = request.getParameter("wc_id");
		String flag = request.getParameter("flag");

		String msg;
		try {
			msg = this.businessBillService.txUrgent(Long.parseLong(billId),
					Long.parseLong(wcId), flag, this.businessBillItemDao);
		} catch (NotAllowException arg8) {
			msg = arg8.getMessage();
		} catch (CannotAcquireLockException arg9) {
			msg = "事务冲突故障，请重新操作！";
		}

		mv.addObject("returnValue", billId);
		EncCommonHelper.setAlertMessage(request, msg);
		return mv;
	}

	public ModelAndView handleProComplete(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		String billId = request.getParameter("bill_id");
		String itemId = request.getParameter("item_id");
		String proId = request.getParameter("pro_id");
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
		List proList = this.workProcessDao.getList(0L, false);
		List mtList = this.makeTypeDao.getList(false);
		boolean saProComp = false;
		boolean saFolComp = false;
		boolean saBusComp = false;
		SmsAlert sa = this.smsAlertDao.get("PRO_COMP");
		if (sa != null && sa.getStatus() != null && sa.getStatus().equals("Y")) {
			saProComp = true;
		}

		sa = this.smsAlertDao.get("FOL_COMP");
		Object saFolRecList = new ArrayList();
		if (sa != null && sa.getStatus() != null && sa.getStatus().equals("Y")) {
			saFolComp = true;
			saFolRecList = this.smsAlertDao.getReceiverList(sa.getId());
		}

		sa = this.smsAlertDao.get("BUS_COMPLETE");
		String customTxt = "";
		if (sa != null && sa.getStatus() != null && sa.getStatus().equals("Y")) {
			saBusComp = true;
			customTxt = sa.getCustomTxt();
		}

		String msg = "";

		try {
			String[] w = billId.split(";");
			String[] itemArr = itemId.split(";");
			String[] proArr = proId.split(";");

			for (int i = 0; i < w.length; ++i) {
				Map map = this.businessBillService.txProComplete(
						Long.parseLong(w[i]), Long.parseLong(itemArr[i]),
						Long.parseLong(proArr[i]), proList, mtList, ub,
						this.businessBillItemDao, this.idGenerator);
				String status = (String) map.get("status");
				if (status.equals("ERROR")) {
					if (!msg.equals("")) {
						msg = msg + "<br>";
					}

					msg = msg + map.get("msg");
				} else {
					if (map.get("proMsg") != null) {
						try {
							if (saProComp) {
								PageHelper.sendProCompMsg(map, mtList, ub,
										this.stafferDao, this.idGenerator);
							}
						} catch (Exception arg26) {
							arg26.printStackTrace();
						}
					}

					if (map.get("comp") != null) {
						try {
							if (saFolComp) {
								PageHelper.sendFolCompMsg(map, ub,
										(List) saFolRecList, this.stafferDao,
										this.idGenerator);
							}
						} catch (Exception arg25) {
							arg25.printStackTrace();
						}

						try {
							if (saBusComp) {
								PageHelper.sendBusCompSms(map, customTxt,
										ent.getShortName(), this.stafferDao,
										this.idGenerator);
							}
						} catch (Exception arg24) {
							arg24.printStackTrace();
						}
					}
				}
			}

			if (msg.equals("")) {
				msg = "保存成功！";
			}
		} catch (CannotAcquireLockException arg27) {
			msg = "事务冲突故障，请重新操作！";
		}

		mv.addObject("returnValue", billId);
		EncCommonHelper.setAlertMessage(request, msg);
		return mv;
	}

	public ModelAndView handleProBack(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		String billId = request.getParameter("bill_id");
		String itemId = request.getParameter("item_id");
		String proId = request.getParameter("pro_id");
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		List proList = this.workProcessDao.getList(0L, false);
		List mtList = this.makeTypeDao.getList(false);
		boolean saProBack = false;
		SmsAlert sa = this.smsAlertDao.get("PRO_BACK");
		if (sa != null && sa.getStatus() != null && sa.getStatus().equals("Y")) {
			saProBack = true;
		}

		String msg = "";

		try {
			String[] w = billId.split(";");
			String[] itemArr = itemId.split(";");
			String[] proArr = proId.split(";");

			for (int i = 0; i < w.length; ++i) {
				Map map = this.businessBillService.txProBack(
						Long.parseLong(w[i]), Long.parseLong(itemArr[i]),
						Long.parseLong(proArr[i]), proList, mtList, ub,
						this.businessBillItemDao, this.idGenerator);
				String status = (String) map.get("status");
				if (status.equals("ERROR")) {
					if (!msg.equals("")) {
						msg = msg + "<br>";
					}

					msg = msg + map.get("msg");
				} else {
					try {
						if (map.get("proMsg") != null && saProBack) {
							long me = ((Long) map.get("billId")).longValue();
							long depId = ((Long) map.get("depId")).longValue();
							long estId = ((Long) map.get("estId")).longValue();
							long mtId = ((Long) map.get("mtId")).longValue();
							String currProName = (String) map
									.get("currProName");
							String billCode = (String) map.get("billCode");
							String msgContent = (String) map.get("msgContent");
							Establishment est = (Establishment) this.stafferDao
									.get(Establishment.class, estId);
							String estName = "";
							if (est != null) {
								estName = est.getEstName();
							}

							String mtName = EncCommonHelper
									.getSimpleObjectName(mtList, mtId);
							String msgTitle = estName + billCode + mtName + "从"
									+ currProName + "退回";
							List staList = this.stafferDao.getList(depId, true,
									false, "", "");
							PageHelper.sendMessage(msgTitle, msgContent, me,
									ub, staList, this.stafferDao,
									this.idGenerator);
						}
					} catch (Exception arg34) {
						arg34.printStackTrace();
					}
				}
			}

			if (msg.equals("")) {
				msg = "保存成功！";
			}
		} catch (CannotAcquireLockException arg35) {
			msg = "事务冲突故障，请重新操作！";
		}

		mv.addObject("returnValue", billId);
		EncCommonHelper.setAlertMessage(request, msg);
		return mv;
	}

	public ModelAndView handleProSet(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.dialogSuccessView);
		String billId = request.getParameter("bill_id");
		String itemId = request.getParameter("item_id");
		String wcId = request.getParameter("wc_id");
		String proId = request.getParameter("pro_id");
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		List mtList = this.makeTypeDao.getList(false);
		boolean saProComp = false;
		SmsAlert sa = this.smsAlertDao.get("PRO_COMP");
		if (sa != null && sa.getStatus() != null && sa.getStatus().equals("Y")) {
			saProComp = true;
		}

		String msg = "";

		try {
			Map w = this.businessBillService.txProSet(Long.parseLong(billId),
					Long.parseLong(itemId), Long.parseLong(wcId),
					Long.parseLong(proId), mtList, ub,
					this.businessBillItemDao, this.idGenerator);
			String status = (String) w.get("status");
			if (status.equals("ERROR")) {
				if (!msg.equals("")) {
					msg = msg + "<br>";
				}

				msg = msg + w.get("msg");
			} else {
				try {
					if (w.get("proMsg") != null && saProComp) {
						long me = ((Long) w.get("billId")).longValue();
						long depId = ((Long) w.get("depId")).longValue();
						long estId = ((Long) w.get("estId")).longValue();
						long mtId = ((Long) w.get("mtId")).longValue();
						String prevProName = (String) w.get("prevProName");
						String currProName = (String) w.get("currProName");
						String billCode = (String) w.get("billCode");
						String msgContent = (String) w.get("msgContent");
						Establishment est = (Establishment) this.stafferDao
								.get(Establishment.class, estId);
						String estName = "";
						if (est != null) {
							estName = est.getEstName();
						}

						String mtName = EncCommonHelper.getSimpleObjectName(
								mtList, mtId);
						String msgTitle = estName + billCode + mtName + "从"
								+ prevProName + "转到" + currProName;
						List staList = this.stafferDao.getList(depId, true,
								false, "", "");
						PageHelper.sendMessage(msgTitle, msgContent, me, ub,
								staList, this.stafferDao, this.idGenerator);
					}
				} catch (Exception arg31) {
					arg31.printStackTrace();
				}
			}

			if (msg.equals("")) {
				msg = "保存成功！";
			}
		} catch (CannotAcquireLockException arg32) {
			msg = "事务冲突故障，请重新操作！";
		}

		mv.addObject("returnValue", billId);
		EncCommonHelper.setAlertMessage(request, msg);
		return mv;
	}

	public ModelAndView handleListForTask(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "BUSI_TASK")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForTaskView);
			String contentType = request.getParameter("content_type");
			QueryParameterBean b = EncBusinessBillMACtrHelper
					.handleListForTask(request, this.dataSource);
			QueryResult qr;
			if (contentType != null && contentType.equals("EXCEL")) {
				qr = this.queryDao.doQuery(b.getQParas(), b.getOParas(),
						b.getGParas(), b.getShortNameMap(), b.getRetObjs(),
						(String[]) null);
				HashMap arg15 = new HashMap();
				arg15.put("list", qr.getList());
				arg15.put("mtList", this.makeTypeDao.getList(false));
				BusinessBillListForTaskExcelView arg17 = new BusinessBillListForTaskExcelView();
				return new ModelAndView(arg17, arg15);
			} else {
				qr = this.queryDao.doQuery(b.getCurrentPage(), b.getPageSize(),
						b.getQParas(), b.getOParas(), (String[]) null,
						b.getShortNameMap(), b.getRetObjs(), (String[]) null);
				List proList = this.workProcessDao.getList(0L, true);

				for (int ub = 0; ub < qr.getList().size(); ++ub) {
					Object[] ent = (Object[]) qr.getList().get(ub);
					long proId = Long.parseLong(ent[18].toString());
					long wcId = Long.parseLong(ent[20].toString());
					long preId = this.getPreProcessId(proList, wcId, proId);
					if (preId == 0L) {
						ent[21] = "N";
					} else {
						ent[21] = "Y";
					}
				}

				mv.addAllObjects(b.getParameters());
				mv.addObject("qr", qr);
				UserBean arg16 = EncCommonHelper.getCurrentUserAccount(request);
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, arg16));
				mv.addObject("depList", this.departmentDao.getList(true));
				mv.addObject("mtList", this.makeTypeDao.getList(false));
				EnterpriseInfo arg18 = EncCommonHelper
						.getEnterpriseInfo(request);
				mv.addObject("wcList", PageHelper.getWorkCenterList(
						this.workCenterDao, arg16, arg18));
				return mv;
			}
		}
	}

	private long getPreProcessId(List proList, long wcId, long proId) {
		long preProId = 0L;

		for (int i = 0; i < proList.size(); ++i) {
			WorkProcess p = (WorkProcess) proList.get(i);
			if (p.getWorkCenterId() == wcId) {
				if (p.getId() != proId && p.getEnabled().equals("Y")) {
					preProId = p.getId();
				}

				if (p.getId() == proId) {
					break;
				}
			}
		}

		return preProId;
	}

	public ModelAndView handleInfoForPro(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.infoForProView);
		String billId = request.getParameter("bill_id");
		String wcId = request.getParameter("wc_id");
		BusinessBill bb = (BusinessBill) this.businessBillDao.get(
				BusinessBill.class, Long.parseLong(billId));
		mv.addObject("record", bb);
		if (bb != null) {
			mv.addObject(
					"est",
					this.businessBillDao.get(Establishment.class,
							bb.getClientId()));
		}

		mv.addObject("itemList", this.businessBillItemDao.getListWidthExt(Long
				.parseLong(billId)));
		mv.addObject("wc", this.businessBillDao.get(WorkCenter.class,
				Long.parseLong(wcId)));
		mv.addObject("mtList", this.makeTypeDao.getList(false));
		mv.addObject("proList",
				this.workProcessDao.getList(Long.parseLong(wcId), false));
		return mv;
	}

	public ModelAndView handleListForOv(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "OV_PERC_SPEC")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.listForOvView);
			QueryParameterBean b = EncBusinessBillMACtrHelper.handleListForOv(
					request, this.dataSource);
			QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
					b.getPageSize(), b.getQParas(), b.getOParas(),
					(String[]) null, b.getShortNameMap(), b.getRetObjs(),
					(String[]) null);
			mv.addAllObjects(b.getParameters());
			mv.addObject("qr", qr);
			mv.addObject("tsList", this.tallySetDao.getList(true));
			return mv;
		}
	}

	public ModelAndView handleProfitDetail(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.profitDetailView);
		String contentType = request.getParameter("content_type");
		long id = Long.parseLong(request.getParameter("id"));
		BusinessBill bill = (BusinessBill) this.businessBillDao.get(
				BusinessBill.class, id);
		BusinessBillExt be = (BusinessBillExt) this.businessBillDao.get(
				BusinessBillExt.class, id);
		BusinessProfit pro = this.businessBillDao.getBusinessProfit(bill
				.getBillCode());
		Establishment est = (Establishment) this.businessBillDao.get(
				Establishment.class, bill.getClientId());
		List list = this.stockDao.getInOutList(bill.getBillCode(), "", 0L);
		HashMap nameMap = new HashMap();
		ArrayList arr = new ArrayList();
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");

		for (int coopList = 0; coopList < list.size(); ++coopList) {
			Object[] feeList = (Object[]) list.get(coopList);
			InOutDetailBean mtList = new InOutDetailBean();
			mtList.setBillCode(feeList[0].toString());
			mtList.setBillDate(sf.parse(feeList[1].toString()));
			mtList.setOtherType(feeList[2].toString());
			mtList.setOtherName(this.getOtherName(nameMap,
					Long.parseLong(feeList[3].toString()),
					mtList.getOtherType()));
			if (feeList[4] != null) {
				mtList.setProductCode(feeList[4].toString());
			}

			mtList.setProductName(feeList[5].toString());
			if (feeList[6] != null) {
				mtList.setProductUnit(feeList[6].toString());
			}

			mtList.setBillType(feeList[8].toString());
			if (mtList.getBillType().equals("IN")) {
				mtList.setInAmount(new BigDecimal(feeList[7].toString()));
				mtList.setInCost(new BigDecimal(feeList[9].toString()));
			} else {
				mtList.setOutAmount(new BigDecimal(feeList[7].toString()));
				mtList.setOutCost(new BigDecimal(feeList[9].toString()));
			}

			arr.add(mtList);
		}

		List arg26 = this.cooperBillItemDao.getListForBusinessBill(
				bill.getId(), true);
		List arg27 = this.feeBillDao.getListForBusinessBill(bill.getId(), true);
		List arg28 = this.makeTypeDao.getList(false);
		List depList = this.departmentDao.getList(false);
		List ftList = this.feeTypeDao.getList(false);
		BigDecimal percent = new BigDecimal(0);
		BigDecimal cost = bill.getCost().add(be.getAdjustCost());
		if (cost.compareTo(new BigDecimal(0)) != 0) {
			percent = pro.getProfitCost().multiply(new BigDecimal(100))
					.divide(cost, 2, 4);
		}

		String designerName = "";
		String followerName = "";
		String[] map;
		int v;
		String[] nameArr;
		if (bill.getDesignerNameStr() != null
				&& !bill.getDesignerNameStr().equals("")) {
			map = bill.getDesignerNameStr().split(";");

			for (v = 0; v < map.length; ++v) {
				nameArr = map[v].split(" ");
				if (!designerName.equals("")) {
					designerName = designerName + ";";
				}

				designerName = designerName + nameArr[0];
			}
		}

		if (bill.getFollowerNameStr() != null
				&& !bill.getFollowerNameStr().equals("")) {
			map = bill.getFollowerNameStr().split(";");

			for (v = 0; v < map.length; ++v) {
				nameArr = map[v].split(" ");
				if (!followerName.equals("")) {
					followerName = followerName + ";";
				}

				followerName = followerName + nameArr[0];
			}
		}

		if (contentType != null && contentType.equals("EXCEL")) {
			HashMap arg29 = new HashMap();
			arg29.put("ioList", arr);
			arg29.put("coopList", arg26);
			arg29.put("feeList", arg27);
			arg29.put("bill", bill);
			arg29.put("be", be);
			arg29.put("profit", pro);
			arg29.put("est", est);
			arg29.put("mtList", arg28);
			arg29.put("depList", depList);
			arg29.put("ftList", ftList);
			arg29.put("percent", percent);
			arg29.put("designerName", designerName);
			arg29.put("followerName", followerName);
			BusinessProfitDetailExcelView arg30 = new BusinessProfitDetailExcelView();
			return new ModelAndView(arg30, arg29);
		} else {
			mv.addObject("ioList", arr);
			mv.addObject("coopList", arg26);
			mv.addObject("feeList", arg27);
			mv.addObject("bill", bill);
			mv.addObject("be", be);
			mv.addObject("profit", pro);
			mv.addObject("est", est);
			mv.addObject("mtList", arg28);
			mv.addObject("depList", depList);
			mv.addObject("ftList", ftList);
			mv.addObject("percent", percent);
			mv.addObject("designerName", designerName);
			mv.addObject("followerName", followerName);
			return mv;
		}
	}

	private String getOtherName(Map<String, String> map, long otherId,
			String otherType) {
		String key = otherType + "_" + otherId;
		if (map.containsKey(key)) {
			return ((String) map.get(key)).toString();
		} else {
			String otherName = "";
			if (!otherType.equals("CLIENT") && !otherType.equals("PROVIDER")
					&& !otherType.equals("COOPERATOR")) {
				if (otherType.equals("DEPARTMENT")) {
					Department wc1 = (Department) this.stockDao.get(
							Department.class, otherId);
					if (wc1 != null) {
						otherName = wc1.getDepartmentName();
					}
				} else if (otherType.equals("STOREHOUSE")) {
					Storehouse wc2 = (Storehouse) this.stockDao.get(
							Storehouse.class, otherId);
					if (wc2 != null) {
						otherName = wc2.getStoName();
					}
				} else if (otherType.equals("WORK_CENTER")) {
					WorkCenter wc3 = (WorkCenter) this.stockDao.get(
							WorkCenter.class, otherId);
					if (wc3 != null) {
						otherName = wc3.getWcName();
					}
				}
			} else {
				Establishment wc = (Establishment) this.stockDao.get(
						Establishment.class, otherId);
				if (wc != null) {
					otherName = wc.getEstName();
				}
			}

			map.put(key, otherName);
			return otherName;
		}
	}

	public ModelAndView handleReceivableAgeList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "CLIE_UN_RECE_AGE")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			ModelAndView mv = new ModelAndView(this.receivableAgeListView);
			mv.addObject("searchType", request.getParameter("search_type"));
			mv.addObject("estName", request.getParameter("est_name"));
			mv.addObject("areaId", request.getParameter("area_id"));
			mv.addObject("etId", request.getParameter("et_id"));
			mv.addObject("elId", request.getParameter("el_id"));
			mv.addObject("tsId", request.getParameter("ts_id"));
			mv.addObject("mngName", request.getParameter("mng_name"));
			mv.addObject("mngId", request.getParameter("mng_id"));
			mv.addObject("cbEst", request.getParameter("cb_est"));
			mv.addObject("cbArea", request.getParameter("cb_area"));
			mv.addObject("cbEt", request.getParameter("cb_et"));
			mv.addObject("cbEl", request.getParameter("cb_el"));
			mv.addObject("cbTs", request.getParameter("cb_ts"));
			mv.addObject("cbMng", request.getParameter("cb_mng"));
			String searchType = request.getParameter("search_type");
			if (searchType == null || searchType.equals("")) {
				String yearSf = String.valueOf(ub.getUser().getDfTsId());
				mv.addObject("tsId", yearSf);
				mv.addObject("cbTs", "1");
				mv.addObject("searchType", "1");
			}

			mv.addObject("areaList", this.areaDao.getList(true));
			mv.addObject("estTypeList", this.establishmentTypeDao.getList(true));
			mv.addObject("estLevelList",
					this.establishmentLevelDao.getList(true));
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, ub));
			SimpleDateFormat arg15 = new SimpleDateFormat("yyyy");
			SimpleDateFormat monthSf = new SimpleDateFormat("MM");
			Date now = new Date();
			int currYear = Integer.parseInt(arg15.format(now));
			int currMonth = Integer.parseInt(monthSf.format(now));
			String[] monthArr = new String[12];
			int tmpMonth = currMonth;
			int tmpYear = currYear;

			for (int i = 0; i < monthArr.length; ++i) {
				String tmpStr = String.valueOf(tmpYear);
				if (tmpMonth < 10) {
					tmpStr = tmpStr + "-0" + tmpMonth;
				} else {
					tmpStr = tmpStr + "-" + tmpMonth;
				}

				monthArr[i] = tmpStr;
				--tmpMonth;
				if (tmpMonth == 0) {
					tmpMonth = 12;
					--tmpYear;
				}
			}

			mv.addObject("monthArr", monthArr);
			return mv;
		}
	}

	public ModelAndView handleReceivableAgeListData(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String searchType = request.getParameter("search_type");
		String contentType = request.getParameter("content_type");
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		String estName = "";
		String areaId = "0";
		String etId = "0";
		String elId = "0";
		String tsId = "0";
		String mngId = "0";
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
		SimpleDateFormat yearSf = new SimpleDateFormat("yyyy");
		SimpleDateFormat monthSf = new SimpleDateFormat("MM");
		Date now = new Date();
		int currYear = Integer.parseInt(yearSf.format(now));
		int currMonth = Integer.parseInt(monthSf.format(now));
		Calendar c = Calendar.getInstance();
		c.setTime(sf.parse(currYear + "-" + currMonth + "-01"));
		c.add(2, -11);
		Date yearDate = c.getTime();
		String[] monthArr = new String[12];
		int tmpMonth = currMonth;
		int tmpYear = currYear;

		String cbArea;
		for (int managerId = 0; managerId < monthArr.length; ++managerId) {
			cbArea = String.valueOf(tmpYear);
			if (tmpMonth < 10) {
				cbArea = cbArea + "-0" + tmpMonth;
			} else {
				cbArea = cbArea + "-" + tmpMonth;
			}

			monthArr[managerId] = cbArea;
			--tmpMonth;
			if (tmpMonth == 0) {
				tmpMonth = 12;
				--tmpYear;
			}
		}

		if (searchType != null && !searchType.equals("")) {
			if (searchType.equals("2")) {
				estName = request.getParameter("est_name");
			} else {
				String arg40 = request.getParameter("cb_est");
				cbArea = request.getParameter("cb_area");
				String list = request.getParameter("cb_et");
				String estMap = request.getParameter("cb_el");
				String zero = request.getParameter("cb_ts");
				String it = request.getParameter("cb_mng");
				if (arg40 != null && arg40.equals("1")) {
					estName = request.getParameter("est_name");
				}

				if (cbArea != null && cbArea.equals("1")) {
					areaId = request.getParameter("area_id");
				}

				if (list != null && list.equals("1")) {
					etId = request.getParameter("et_id");
				}

				if (estMap != null && estMap.equals("1")) {
					elId = request.getParameter("el_id");
				}

				if (zero != null && zero.equals("1")) {
					tsId = request.getParameter("ts_id");
				}

				if (it != null && it.equals("1")) {
					mngId = request.getParameter("mng_id");
				}
			}
		} else {
			tsId = String.valueOf(ub.getUser().getDfTsId());
		}

		long arg41 = 0L;
		if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
			if (!mngId.equals("0")) {
				if (Long.parseLong(mngId) == ub.getStaffer().getId()) {
					arg41 = ub.getStaffer().getId();
				} else {
					arg41 = -2L;
				}
			} else {
				arg41 = ub.getStaffer().getId();
			}
		} else {
			arg41 = Long.parseLong(mngId);
		}

		List arg42 = this.businessBillDao
				.getReceivableAgeList(estName, Long.parseLong(areaId),
						Long.parseLong(etId), Long.parseLong(elId), arg41,
						Long.parseLong(tsId), ub, yearDate);
		HashMap arg43 = new HashMap();

		int out;
		for (int arg44 = 0; arg44 < arg42.size(); ++arg44) {
			Object[] arg46 = (Object[]) arg42.get(arg44);
			String arr = arg46[0].toString();
			int totalBean = Integer.parseInt(arg46[2].toString());
			int objs = Integer.parseInt(arg46[3].toString());
			BigDecimal doc = (BigDecimal) arg46[4];
			String format = String.valueOf(totalBean);
			if (objs < 10) {
				format = format + "-0" + objs;
			} else {
				format = format + "-" + objs;
			}

			boolean root = false;
			ReceivableAgeBean total;
			if (arg43.containsKey(arr)) {
				total = (ReceivableAgeBean) arg43.get(arr);
				root = true;
			} else {
				total = new ReceivableAgeBean();
				total.setEstId(Long.parseLong(arr));
				total.setEstName(arg46[1].toString());
			}

			if (totalBean == 0) {
				total.setYearBefCost(doc);
				total.setRemCost(total.getRemCost().add(doc));
			} else {
				boolean tmpElem = false;
				out = 0;

				for (int output = 0; output < monthArr.length; ++output) {
					if (format.equals(monthArr[output])) {
						tmpElem = true;
						out = output;
						break;
					}
				}

				if (tmpElem) {
					total.getMonthCost()[out] = doc;
					total.setRemCost(total.getRemCost().add(doc));
				}
			}

			if (!root) {
				arg43.put(arr, total);
			}
		}

		BigDecimal arg45 = new BigDecimal(0);
		Iterator arg47 = arg43.keySet().iterator();
		ArrayList arg48 = new ArrayList();
		ReceivableAgeBean arg49 = new ReceivableAgeBean();

		while (true) {
			ReceivableAgeBean arg52;
			do {
				if (!arg47.hasNext()) {
					Object[] arg51 = arg48.toArray();
					Arrays.sort(arg51, new ReceivableAgeBeanComparator());
					if (contentType != null && contentType.equals("EXCEL")) {
						HashMap arg54 = new HashMap();
						arg54.put("list", arg51);
						arg54.put("monthArr", monthArr);
						arg54.put("totalBean", arg49);
						ReceivableAgeListExcelView arg58 = new ReceivableAgeListExcelView();
						return new ModelAndView(arg58, arg54);
					}

					Document arg53 = DocumentHelper.createDocument();
					OutputFormat arg56 = OutputFormat.createPrettyPrint();
					arg56.setTrimText(false);
					arg56.setEncoding("utf-8");
					Element arg57 = arg53.addElement("body");
					Element arg59 = arg57.addElement("total");
					Element arg60 = arg59.addElement("rem_cost");
					arg60.setText(EncCommonHelper.parseBigDecimal(arg49
							.getRemCost()));

					for (out = 0; out < arg49.getMonthCost().length; ++out) {
						arg60 = arg59.addElement("month" + out);
						arg60.setText(EncCommonHelper.parseBigDecimal(arg49
								.getMonthCost()[out]));
					}

					arg60 = arg59.addElement("year_bef_cost");
					arg60.setText(EncCommonHelper.parseBigDecimal(arg49
							.getYearBefCost()));

					for (out = 0; out < arg51.length; ++out) {
						ReceivableAgeBean arg61 = (ReceivableAgeBean) arg51[out];
						Element data = arg57.addElement("data");
						arg60 = data.addElement("est_id");
						arg60.setText(String.valueOf(arg61.getEstId()));
						arg60 = data.addElement("est_name");
						arg60.setText(arg61.getEstName());
						arg60 = data.addElement("rem_cost");
						arg60.setText(EncCommonHelper.parseBigDecimal(arg61
								.getRemCost()));

						for (int j = 0; j < arg61.getMonthCost().length; ++j) {
							arg60 = data.addElement("month" + j);
							arg60.setText(EncCommonHelper.parseBigDecimal(arg61
									.getMonthCost()[j]));
						}

						arg60 = data.addElement("year_bef_cost");
						arg60.setText(EncCommonHelper.parseBigDecimal(arg61
								.getYearBefCost()));
					}

					response.setContentType("text/xml");
					response.setCharacterEncoding("utf-8");
					response.setHeader("Cache-Control", "no-cache");
					response.setHeader("Pragma", "no-cache");
					ServletOutputStream arg63 = response.getOutputStream();
					XMLWriter arg62 = new XMLWriter(arg63, arg56);
					arg62.write(arg53);
					arg63.flush();
					arg63.close();
					return null;
				}

				Object arg50 = arg47.next();
				arg52 = (ReceivableAgeBean) arg43.get(arg50);
			} while (arg52.getRemCost().compareTo(arg45) == 0);

			arg49.setRemCost(arg49.getRemCost().add(arg52.getRemCost()));
			arg49.setYearBefCost(arg49.getYearBefCost().add(
					arg52.getYearBefCost()));

			for (int arg55 = 0; arg55 < arg49.getMonthCost().length; ++arg55) {
				arg49.getMonthCost()[arg55] = arg49.getMonthCost()[arg55]
						.add(arg52.getMonthCost()[arg55]);
			}

			arg48.add(arg52);
		}
	}

	public ModelAndView handleMtBusinessDate(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "MT_BUSI_DATE")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			Date startDate = null;
			Date endDate = null;
			long tsId = 0L;
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			String startDateStr = request.getParameter("start_date");
			String endDateStr = request.getParameter("end_date");
			String tsIdStr = request.getParameter("ts_id");
			Date allowStart = null;
			if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
				allowStart = EncCommonHelper.getEarlDataDate(request);
			}

			if (startDateStr != null && !startDateStr.equals("")) {
				startDate = sf.parse(startDateStr);
				endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
						"yyyy-MM-dd"));
			} else {
				Date busTotal = new Date();
				startDateStr = sf.format(busTotal);
				endDateStr = sf.format(busTotal);
				startDate = busTotal;
				endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
						"yyyy-MM-dd"));
				tsIdStr = String.valueOf(ub.getUser().getDfTsId());
			}

			if (allowStart != null && allowStart.after(startDate)) {
				startDate = allowStart;
			}

			if (tsIdStr != null && !tsIdStr.equals("")) {
				tsId = Long.parseLong(tsIdStr);
			}

			new BigDecimal(0);
			BigDecimal favTotal = new BigDecimal(0);
			BigDecimal costTotal = new BigDecimal(0);
			List list = this.businessBillDao.getMtBusinessDateCount(startDate,
					endDate, tsId, ub);
			if (!list.isEmpty() && list.get(0) != null) {
				Object[] mtList = (Object[]) list.get(0);
				if (mtList[0] != null) {
					favTotal = (BigDecimal) mtList[0];
				}

				if (mtList[1] != null) {
					costTotal = (BigDecimal) mtList[1];
				}
			}

			BigDecimal busTotal1 = favTotal.add(costTotal);
			List mtList1 = this.makeTypeDao.getList(false);
			list = this.businessBillDao.getMtBusinessDate(startDate, endDate,
					tsId, ub);
			List arr = this.parseMtBusinessDate(mtList1, list);
			String contentType = request.getParameter("content_type");
			if (contentType != null && contentType.equals("EXCEL")) {
				HashMap mv1 = new HashMap();
				mv1.put("list", arr);
				mv1.put("busTotal", busTotal1);
				mv1.put("favTotal", favTotal);
				mv1.put("costTotal", costTotal);
				MtBusinessDateExcelView v = new MtBusinessDateExcelView();
				return new ModelAndView(v, mv1);
			} else {
				ModelAndView mv = new ModelAndView(this.mtBusinessDateView);
				mv.addObject("startDate", startDateStr);
				mv.addObject("endDate", endDateStr);
				mv.addObject("tsId", tsIdStr);
				mv.addObject("list", arr);
				mv.addObject("busTotal", busTotal1);
				mv.addObject("favTotal", favTotal);
				mv.addObject("costTotal", costTotal);
				mv.addObject("tsList",
						PageHelper.getTallySetList(this.tallySetDao, ub));
				return mv;
			}
		}
	}

	private List parseMtBusinessDate(List mtList, List list) {
		HashMap map = new HashMap();

		MakeType mt;
		int j;
		label100 : for (int arr = 0; arr < mtList.size(); ++arr) {
			mt = (MakeType) mtList.get(arr);

			for (int stack = 0; stack < list.size(); ++stack) {
				Object[] layerNumStack = (Object[]) list.get(stack);
				if (layerNumStack[0] != null) {
					long nextParentCode = Long.parseLong(layerNumStack[0]
							.toString());
					if (mt.getId() == nextParentCode) {
						j = Integer.parseInt(layerNumStack[1].toString());
						BigDecimal tmpObjs = (BigDecimal) layerNumStack[2];
						String mtId = String.valueOf(mt.getId());
						Object[] itemObjs;
						if (map.containsKey(mtId)) {
							itemObjs = (Object[]) map.get(mtId);
							itemObjs[1] = String.valueOf(Integer
									.parseInt(layerNumStack[1].toString()) + j);
							itemObjs[2] = ((BigDecimal) itemObjs[2])
									.add(tmpObjs);
						} else {
							itemObjs = new Object[]{mt, String.valueOf(j),
									tmpObjs, Integer.valueOf(0)};
							map.put(mtId, itemObjs);
						}

						if (mt.getParentId() == 0L) {
							break;
						}

						String count = mt.getParentIdStr();
						int cost = 0;

						while (true) {
							if (cost >= mtList.size()) {
								continue label100;
							}

							MakeType tmpMt = (MakeType) mtList.get(cost);
							mtId = String.valueOf(tmpMt.getId());
							if (count.indexOf(";" + mtId + ";") != -1) {
								if (map.containsKey(mtId)) {
									itemObjs = (Object[]) map.get(mtId);
									itemObjs[1] = String.valueOf(Integer
											.parseInt(layerNumStack[1]
													.toString())
											+ j);
									itemObjs[2] = ((BigDecimal) itemObjs[2])
											.add(tmpObjs);
								} else {
									itemObjs = new Object[]{tmpMt,
											String.valueOf(j), tmpObjs,
											Integer.valueOf(0)};
									map.put(mtId, itemObjs);
								}
							}

							++cost;
						}
					}
				}
			}
		}

		ArrayList arg16 = new ArrayList();
		Stack arg17 = new Stack();
		Stack arg18 = new Stack();

		for (int arg19 = mtList.size(); arg19 > 0; --arg19) {
			mt = (MakeType) mtList.get(arg19 - 1);
			if (mt.getObjectParentCode() == null
					|| mt.getObjectParentCode().equals("")
					|| mt.getObjectParentCode().equals("0")) {
				arg17.push(mt);
				arg18.push("1");
			}
		}

		Object[] arg22;
		while (!arg17.isEmpty()) {
			mt = (MakeType) arg17.pop();
			int currentLayerNum = Integer.parseInt(arg18.pop().toString());
			String arg21 = String.valueOf(mt.getId());
			if (map.containsKey(arg21)) {
				arg22 = (Object[]) map.get(arg21);
				arg22[3] = Integer.valueOf(currentLayerNum);
				arg16.add(arg22);
			}

			String arg20 = mt.getObjectCode();

			for (int arg23 = mtList.size(); arg23 > 0; --arg23) {
				MakeType arg24 = (MakeType) mtList.get(arg23 - 1);
				if (arg24.getObjectParentCode().equals(arg20)) {
					arg17.push(arg24);
					arg18.push(String.valueOf(currentLayerNum + 1));
				}
			}
		}

		for (j = 0; j < list.size(); ++j) {
			arg22 = (Object[]) list.get(j);
			if (arg22[0] != null) {
				long arg25 = Long.parseLong(arg22[0].toString());
				if (arg25 == 0L) {
					int arg26 = Integer.parseInt(arg22[1].toString());
					BigDecimal arg27 = (BigDecimal) arg22[2];
					arg16.add(new Object[]{null, String.valueOf(arg26), arg27,
							Integer.valueOf(1)});
					break;
				}
			}
		}

		return arg16;
	}

	public ModelAndView handleBusinessFileUpload(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.businessFileUploadView);
		String serverName = request.getServerName();
		mv.addObject("serverName", serverName);
		mv.addObject("serverPort", String.valueOf(EncCommonHelper
				.getEnterpriseInfo(request).getUploadPort()));
		return mv;
	}

	public ModelAndView handleBusinessBillPrintSelect(
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ModelAndView mv = new ModelAndView(this.businessBillPrintSelectView);
		return mv;
	}

	public ModelAndView handleItemProductSelect(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String type = request.getParameter("type");
		String key = request.getParameter("key");
		long billId = 0L;
		long estId = 0L;
		String estName = "";
		BusinessBill map;
		if (type.equals("ID")) {
			billId = Long.parseLong(key);
			map = (BusinessBill) this.businessBillItemDao.get(
					BusinessBill.class, billId);
			if (map != null) {
				estId = map.getClientId();
			}
		} else {
			map = this.businessBillDao.get(key);
			if (map != null) {
				billId = map.getId();
				estId = map.getClientId();
			}
		}

		if (estId != 0L) {
			Establishment arg17 = (Establishment) this.businessBillItemDao.get(
					Establishment.class, estId);
			if (arg17 != null) {
				estName = arg17.getEstName();
			}
		}

		HashMap arg18 = new HashMap();
		arg18.put("estId", Long.valueOf(estId));
		arg18.put("estName", estName);
		ArrayList items = new ArrayList();
		if (billId != 0L) {
			List mapper = this.businessBillItemDao.getProductList(billId);

			for (int json = 0; json < mapper.size(); ++json) {
				Object[] out = (Object[]) mapper.get(json);
				Product p = (Product) out[0];
				BigDecimal amount;
				if (out[1].toString().equals("AMOUNT")) {
					amount = (BigDecimal) out[2];
				} else {
					amount = (BigDecimal) out[3];
				}

				HashMap item = new HashMap();
				item.put("prodId", Long.valueOf(p.getId()));
				item.put("prodCode", p.getProductCode());
				item.put("prodName", p.getProductName());
				item.put("unit", p.getUnit());
				item.put("amou", EncCommonHelper.parseBigDecimal(amount));
				items.add(item);
			}
		}

		arg18.put("items", items);
		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg19 = new ObjectMapper();
		String arg20 = arg19.writeValueAsString(arg18);
		ServletOutputStream arg21 = response.getOutputStream();
		arg21.write(arg20.getBytes("utf-8"));
		arg21.flush();
		arg21.close();
		return null;
	}

	public ModelAndView handleLabelLog(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		String itemIdStr = request.getParameter("item_id_str");
		String[] ids = itemIdStr.split(";");
		long[] idArr = new long[ids.length];

		for (int msg = 0; msg < idArr.length; ++msg) {
			idArr[msg] = Long.parseLong(ids[msg]);
		}

		String arg8 = "";
		if (ub != null) {
			this.businessBillItemDao.updatePrintNum(idArr, ub.getStaffer()
					.getStafferName());
			arg8 = "OK";
		} else {
			arg8 = "NO_LOGIN";
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ServletOutputStream out = response.getOutputStream();
		out.write(arg8.getBytes());
		out.flush();
		out.close();
		return null;
	}

	public ModelAndView handleGetCreditAlert(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		long bbId = Long.parseLong(request.getParameter("bb_id"));
		BigDecimal cost = new BigDecimal(request.getParameter("cost"));
		long clientId = Long.parseLong(request.getParameter("client_id"));
		long tsId = Long.parseLong(request.getParameter("ts_id"));
		String ret = "0";
		if (clientId != 0L) {
			Establishment out = (Establishment) this.businessBillDao.get(
					Establishment.class, clientId);
			if (out != null && out.getCreditCost() != 0) {
				BigDecimal remCost = this.businessBillDao.getReceivableCost(
						clientId, tsId);
				if (remCost == null) {
					remCost = new BigDecimal(0);
				}

				if (bbId != 0L) {
					BusinessBillExt difCost = (BusinessBillExt) this.businessBillDao
							.get(BusinessBillExt.class, bbId);
					if (difCost.getExamined().equals("Y")) {
						BusinessBill bb = (BusinessBill) this.businessBillDao
								.get(BusinessBill.class, bbId);
						remCost = remCost.subtract(bb.getCost());
					}
				}

				BigDecimal difCost1 = remCost.add(cost).subtract(
						new BigDecimal(out.getCreditCost()));
				if (difCost1.compareTo(new BigDecimal(0)) == 1) {
					ret = difCost1.toString();
				}
			}
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ServletOutputStream out1 = response.getOutputStream();
		out1.write(ret.getBytes());
		out1.flush();
		out1.close();
		return null;
	}

	public ModelAndView handleAppList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HashMap map = new HashMap();
		UserStatus s = EncInterceptorHelper.checkAppUserSignon(request);
		UserBean ub = s.getUserBean();
		String json;
		if (ub == null) {
			map.put("status", "NO_LOGIN");
			map.put("errMsg", "");
		} else if (!EncCommonHelper.checkPrivilege(request, "BUSI_BILL_SEAR")) {
			map.put("status", "ERROR");
			map.put("errMsg", "您还没有此功能的使用权限，请确认返回！");
		} else {
			try {
				String mapper = request.getParameter("est_name");
				json = request.getParameter("start_date");
				String out = request.getParameter("end_date");
				String lm = request.getParameter("lm");
				String exam = request.getParameter("exam");
				String clos = request.getParameter("clos");
				String deli = request.getParameter("deli");
				String coll = request.getParameter("coll");
				String tsIdStr = request.getParameter("ts_id");
				String orde = request.getParameter("orde");
				String showPrev = request.getParameter("show_prev");
				String initQuer = request.getParameter("init_quer");
				long mngId = 0L;
				long tsId = 0L;
				if (tsIdStr != null && !tsIdStr.equals("")) {
					tsId = Long.parseLong(tsIdStr);
				}

				if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
					mngId = ub.getStaffer().getId();
				}

				Date allowStart = null;
				Date startDate = null;
				Date endDate = null;
				if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
					allowStart = EncCommonHelper.getEarlDataDate(request);
				}

				SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
				SimpleDateFormat sfl = new SimpleDateFormat("yyyy-MM-dd HH:mm");
				if (json != null && !json.equals("")) {
					startDate = sf.parse(json);
				}

				if (out != null && !out.equals("")) {
					endDate = sf.parse(EncCommonHelper.getNextDateStr(out,
							"yyyy-MM-dd"));
				}

				if (startDate == null) {
					startDate = allowStart;
				} else if (allowStart != null && allowStart.after(startDate)) {
					startDate = allowStart;
				}

				if (orde == null || orde.equals("")) {
					orde = "ORDE_DATE";
				}

				int total = 0;
				BigDecimal cost = new BigDecimal(0);
				BigDecimal remCost = new BigDecimal(0);
				List list = this.businessBillDao.getAppListCount(startDate,
						endDate, mapper, lm, exam, clos, deli, coll, tsId, ub,
						mngId);
				if (list != null && !list.isEmpty() && list.get(0) != null) {
					Object[] perPageNum = (Object[]) list.get(0);
					if (perPageNum[1] != null) {
						total = Integer.parseInt(perPageNum[0].toString());
						cost = (BigDecimal) perPageNum[1];
						remCost = (BigDecimal) perPageNum[2];
					}
				}

				if (!EncCommonHelper
						.checkPurePrivilege(request, "NO_BUSI_COST")) {
					map.put("cost", cost);
					map.put("remCost", remCost);
				} else {
					map.put("cost", "");
					map.put("remCost", "");
				}

				map.put("total", Integer.valueOf(total));
				int arg44 = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						total, arg44);
				if (total > pageno * arg44) {
					map.put("more", "Y");
				} else {
					map.put("more", "N");
				}

				if (showPrev != null && showPrev.equals("Y")) {
					list = this.businessBillDao.getAppList(startDate, endDate,
							mapper, lm, exam, clos, deli, coll, tsId, ub,
							mngId, orde, 0, pageno * arg44);
				} else {
					list = this.businessBillDao.getAppList(startDate, endDate,
							mapper, lm, exam, clos, deli, coll, tsId, ub,
							mngId, orde, (pageno - 1) * arg44, arg44);
				}

				ArrayList items = new ArrayList();

				for (int tmpList = 0; tmpList < list.size(); ++tmpList) {
					HashMap tsItems = new HashMap();
					Object[] i = (Object[]) list.get(tmpList);
					BusinessBill item = (BusinessBill) i[0];
					String ts = (String) i[1];
					String creaTime = "";
					String deliDate = "";
					BusinessBillExt be = (BusinessBillExt) i[2];
					if (item.getLinkman() != null
							&& !item.getLinkman().equals("")) {
						ts = ts + "(" + item.getLinkman() + ")";
					}

					if (item.getCreateTime() != null) {
						creaTime = sfl.format(item.getCreateTime());
					}

					if (item.getDeliverDate() != null) {
						deliDate = sfl.format(item.getDeliverDate());
					}

					if (item.getFollowerNameStr() != null
							&& !item.getFollowerNameStr().equals("")) {
						deliDate = deliDate + "（" + item.getFollowerNameStr()
								+ "）";
					}

					if (!EncCommonHelper.checkPurePrivilege(request,
							"NO_BUSI_COST")) {
						tsItems.put("cost", item.getCost());
						tsItems.put("remCost",
								item.getCost().add(be.getAdjustCost())
										.subtract(be.getCollectedCost()));
					} else {
						tsItems.put("cost", "");
						tsItems.put("remCost", "");
					}

					tsItems.put("creaName", item.getCreaterName());
					tsItems.put("creaTime", creaTime);
					tsItems.put("estName", ts);
					tsItems.put("id", Long.valueOf(item.getId()));
					tsItems.put("date", sfl.format(item.getOrderDate()));
					tsItems.put("deliDate", deliDate);
					tsItems.put("cont", PageHelper.parseNull(item.getContent()));
					if (be.getClosed().equals("Y")) {
						tsItems.put("stat", "CLOS");
					} else if (be.getDelivered().equals("Y")) {
						tsItems.put("stat", "DELI");
					} else if (be.getCompleted().equals("Y")) {
						tsItems.put("stat", "COMP");
					} else if (be.getExamined().equals("Y")) {
						tsItems.put("stat", "EXAM");
					} else {
						tsItems.put("stat", "UNEXAM");
					}

					items.add(tsItems);
				}

				map.put("items", items);
				if (initQuer != null && initQuer.equals("Y")) {
					List arg45 = PageHelper.getTallySetList(this.tallySetDao,
							ub);
					ArrayList arg46 = new ArrayList();

					for (int arg47 = 0; arg47 < arg45.size(); ++arg47) {
						HashMap arg48 = new HashMap();
						TallySet arg49 = (TallySet) arg45.get(arg47);
						arg48.put("id", Long.valueOf(arg49.getId()));
						arg48.put("name", arg49.getTitle());
						arg46.add(arg48);
					}

					map.put("tsItems", arg46);
				}

				map.put("status", "OK");
				map.put("errMsg", "");
			} catch (Exception arg41) {
				map.put("status", "ERROR");
				map.put("errMsg", arg41.toString());
			}
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg42 = new ObjectMapper();
		json = arg42.writeValueAsString(map);
		ServletOutputStream arg43 = response.getOutputStream();
		arg43.write(json.getBytes("utf-8"));
		arg43.flush();
		arg43.close();
		return null;
	}

	public ModelAndView handleAppInfo(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HashMap map = new HashMap();

		try {
			long mapper = Long.parseLong(request.getParameter("id"));
			BusinessBill out = (BusinessBill) this.businessBillDao.get(
					BusinessBill.class, mapper);
			BusinessBillExt be = (BusinessBillExt) this.businessBillDao.get(
					BusinessBillExt.class, mapper);
			List itemList = this.businessBillItemDao.getList(mapper);
			List mtList = this.makeTypeDao.getList(false);
			SimpleDateFormat sfl = new SimpleDateFormat("yyyy-MM-dd HH:mm");
			String bankName = "";
			String deliDate = "";
			String estName = "";
			String tsName = "";
			String creaTime = "";
			if (out.getBankAccountId() != 0L) {
				BankAccount est = (BankAccount) this.businessBillDao.get(
						BankAccount.class, out.getBankAccountId());
				if (est != null) {
					bankName = est.getBankName();
					if (est.getAccountName() != null
							&& !est.getAccountName().equals("")) {
						bankName = bankName + "(" + est.getAccountName() + ")";
					}
				}
			}

			if (out.getDeliverDate() != null) {
				deliDate = sfl.format(out.getDeliverDate());
			}

			Establishment arg29 = (Establishment) this.businessBillDao.get(
					Establishment.class, out.getClientId());
			if (arg29 != null) {
				estName = arg29.getEstName();
			}

			TallySet ts = (TallySet) this.businessBillDao.get(TallySet.class,
					out.getTallySetId());
			if (ts != null) {
				tsName = ts.getTitle();
			}

			if (out.getCreateTime() != null) {
				creaTime = sfl.format(out.getCreateTime());
			}

			if (!EncCommonHelper.checkPurePrivilege(request, "NO_BUSI_COST")) {
				map.put("cost", out.getCost());
				map.put("favCost", out.getFavCost());
				map.put("impr", out.getImprest());
			} else {
				map.put("cost", "");
				map.put("favCost", "");
				map.put("impr", "");
			}

			map.put("addr", PageHelper.parseNull(out.getAddress()));
			map.put("ba", bankName);
			map.put("code", out.getBillCode());
			map.put("cont", PageHelper.parseNull(out.getContent()));
			map.put("creaName", out.getCreaterName());
			map.put("creaTime", creaTime);
			map.put("deliDate", deliDate);
			map.put("desiName", PageHelper.parseNull(out.getDesignerNameStr()));
			map.put("estName", estName);
			map.put("follName", PageHelper.parseNull(out.getFollowerNameStr()));
			map.put("ladi", PageHelper.parseNull(out.getLadingRequire()));
			map.put("lm", PageHelper.parseNull(out.getLinkman()));
			map.put("mark", PageHelper.parseNull(out.getMark()));
			map.put("mngName", PageHelper.parseNull(out.getManagerName()));
			map.put("date", sfl.format(out.getOrderDate()));
			map.put("phon", PageHelper.parseNull(out.getPhone()));
			map.put("setu", PageHelper.parseNull(out.getSetupRequire()));
			String examName = "";
			String examTime = "";
			if (be.getExamined().equals("Y")) {
				examName = be.getExaminerName();
				if (be.getExamineTime() != null) {
					examTime = sfl.format(be.getExamineTime());
				}
			}

			map.put("exam", be.getExamined());
			map.put("examName", examName);
			map.put("examTime", examTime);
			map.put("tsName", tsName);
			map.put("enab", be.getEnabled());
			ArrayList items = new ArrayList();
			BigDecimal itemTotal = new BigDecimal(0);

			for (int i = 0; i < itemList.size(); ++i) {
				HashMap item = new HashMap();
				BusinessBillItem bi = (BusinessBillItem) itemList.get(i);
				String spec = PageHelper.parseNull(bi.getSpecification());
				String unit = "";
				if (bi.getPriceType().equals("AMOUNT")) {
					item.put("amou",
							EncCommonHelper.parseBigDecimal(bi.getAmount()));
					unit = PageHelper.parseNull(bi.getUnit());
				} else {
					item.put("amou", bi.getSquareNum());
					if (bi.getPriceType().equals("LENGTH")) {
						if (bi.getLengType().equals("M")) {
							unit = "米";
						} else {
							unit = "公分";
						}
					} else {
						unit = "平方米";
					}

					spec = spec + " x "
							+ EncCommonHelper.parseBigDecimal(bi.getAmount());
				}

				if (!EncCommonHelper
						.checkPurePrivilege(request, "NO_BUSI_COST")) {
					item.put("cost", bi.getCost());
					item.put("pric",
							EncCommonHelper.parseBigDecimal(bi.getUnitPrice()));
				} else {
					item.put("cost", "");
					item.put("pric", "");
				}

				item.put("cont", PageHelper.parseNull(bi.getFinishedContent()));
				item.put(
						"mtName",
						EncCommonHelper.getSimpleObjectName(mtList,
								bi.getMakeTypeId()));
				item.put("prod", PageHelper.parseNull(bi.getProName()));
				item.put("requ", PageHelper.parseNull(bi.getMakeRequire()));
				item.put("spec", spec);
				item.put("unit", unit);
				items.add(item);
				itemTotal = itemTotal.add(bi.getCost());
			}

			if (!EncCommonHelper.checkPurePrivilege(request, "NO_BUSI_COST")) {
				map.put("itemTotal", itemTotal);
			} else {
				map.put("itemTotal", "");
			}

			map.put("items", items);
			map.put("status", "OK");
			map.put("errMsg", "");
		} catch (Exception arg26) {
			map.put("status", "ERROR");
			map.put("errMsg", arg26.toString());
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg27 = new ObjectMapper();
		String json = arg27.writeValueAsString(map);
		ServletOutputStream arg28 = response.getOutputStream();
		arg28.write(json.getBytes("utf-8"));
		arg28.flush();
		arg28.close();
		return null;
	}

	public ModelAndView handleAppListForExam(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HashMap map = new HashMap();
		UserStatus s = EncInterceptorHelper.checkAppUserSignon(request);
		UserBean ub = s.getUserBean();
		String json;
		if (ub == null) {
			map.put("status", "NO_LOGIN");
			map.put("errMsg", "");
		} else if (!EncCommonHelper.checkPrivilege(request, "BUSI_EXAM")) {
			map.put("status", "ERROR");
			map.put("errMsg", "您还没有此功能的使用权限，请确认返回！");
		} else {
			try {
				String mapper = request.getParameter("sk");
				json = request.getParameter("ct");
				String out = request.getParameter("ts_id");
				String showPrev = request.getParameter("show_prev");
				String initQuer = request.getParameter("init_quer");
				long mngId = 0L;
				long tsId = 0L;
				if (out != null && !out.equals("")) {
					tsId = Long.parseLong(out);
				}

				if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
					mngId = ub.getStaffer().getId();
				}

				Date allowStart = null;
				if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
					allowStart = EncCommonHelper.getEarlDataDate(request);
				}

				int total = 0;
				BigDecimal cost = new BigDecimal(0);
				List list = this.businessBillDao.getAppListForExamCount(mapper,
						json, tsId, ub, allowStart, mngId);
				if (list != null && !list.isEmpty() && list.get(0) != null) {
					Object[] perPageNum = (Object[]) list.get(0);
					if (perPageNum[1] != null) {
						total = Integer.parseInt(perPageNum[0].toString());
						cost = (BigDecimal) perPageNum[1];
					}
				}

				map.put("cost", cost);
				map.put("total", Integer.valueOf(total));
				int arg32 = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						total, arg32);
				if (total > pageno * arg32) {
					map.put("more", "Y");
				} else {
					map.put("more", "N");
				}

				if (showPrev != null && showPrev.equals("Y")) {
					list = this.businessBillDao.getAppListForExam(mapper, json,
							tsId, ub, allowStart, mngId, 0, pageno * arg32);
				} else {
					list = this.businessBillDao.getAppListForExam(mapper, json,
							tsId, ub, allowStart, mngId, (pageno - 1) * arg32,
							arg32);
				}

				SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
				SimpleDateFormat sfl = new SimpleDateFormat("yyyy-MM-dd HH:mm");
				ArrayList items = new ArrayList();

				for (int tmpList = 0; tmpList < list.size(); ++tmpList) {
					Object[] tsItems = (Object[]) list.get(tmpList);
					BusinessBill i = (BusinessBill) tsItems[0];
					String item = (String) tsItems[1];
					String ts = "";
					if (i.getLinkman() != null && !i.getLinkman().equals("")) {
						item = item + "(" + i.getLinkman() + ")";
					}

					if (i.getCreateTime() != null) {
						ts = sfl.format(i.getCreateTime());
					}

					HashMap item1 = new HashMap();
					item1.put("cost", i.getCost());
					item1.put("creaName", i.getCreaterName());
					item1.put("creaTime", ts);
					item1.put("estName", item);
					item1.put("id", Long.valueOf(i.getId()));
					item1.put("date", sf.format(i.getOrderDate()));
					items.add(item1);
				}

				map.put("items", items);
				if (initQuer != null && initQuer.equals("Y")) {
					List arg33 = PageHelper.getTallySetList(this.tallySetDao,
							ub);
					ArrayList arg34 = new ArrayList();

					for (int arg35 = 0; arg35 < arg33.size(); ++arg35) {
						HashMap arg36 = new HashMap();
						TallySet arg37 = (TallySet) arg33.get(arg35);
						arg36.put("id", Long.valueOf(arg37.getId()));
						arg36.put("name", arg37.getTitle());
						arg34.add(arg36);
					}

					map.put("tsItems", arg34);
				}

				map.put("status", "OK");
				map.put("errMsg", "");
			} catch (Exception arg29) {
				map.put("status", "ERROR");
				map.put("errMsg", arg29.toString());
			}
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg30 = new ObjectMapper();
		json = arg30.writeValueAsString(map);
		ServletOutputStream arg31 = response.getOutputStream();
		arg31.write(json.getBytes("utf-8"));
		arg31.flush();
		arg31.close();
		return null;
	}

	public ModelAndView handleAppListForUnExam(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HashMap map = new HashMap();
		UserStatus s = EncInterceptorHelper.checkAppUserSignon(request);
		UserBean ub = s.getUserBean();
		String json;
		if (ub == null) {
			map.put("status", "NO_LOGIN");
			map.put("errMsg", "");
		} else if (!EncCommonHelper.checkPrivilege(request, "BUSI_UN_EXAM")) {
			map.put("status", "ERROR");
			map.put("errMsg", "您还没有此功能的使用权限，请确认返回！");
		} else {
			try {
				String mapper = request.getParameter("sk");
				json = request.getParameter("ts_id");
				String out = request.getParameter("show_prev");
				String initQuer = request.getParameter("init_quer");
				long mngId = 0L;
				long tsId = 0L;
				if (json != null && !json.equals("")) {
					tsId = Long.parseLong(json);
				}

				if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
					mngId = ub.getStaffer().getId();
				}

				Date allowStart = null;
				if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
					allowStart = EncCommonHelper.getEarlDataDate(request);
				}

				int total = 0;
				BigDecimal cost = new BigDecimal(0);
				List list = this.businessBillDao.getAppListForUnExamCount(
						mapper, tsId, ub, allowStart, mngId);
				if (list != null && !list.isEmpty() && list.get(0) != null) {
					Object[] perPageNum = (Object[]) list.get(0);
					if (perPageNum[1] != null) {
						total = Integer.parseInt(perPageNum[0].toString());
						cost = (BigDecimal) perPageNum[1];
					}
				}

				map.put("cost", cost);
				int arg30 = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						total, arg30);
				if (total > pageno * arg30) {
					map.put("more", "Y");
				} else {
					map.put("more", "N");
				}

				if (out != null && out.equals("Y")) {
					list = this.businessBillDao.getAppListForUnExam(mapper,
							tsId, ub, allowStart, mngId, 0, pageno * arg30);
				} else {
					list = this.businessBillDao.getAppListForUnExam(mapper,
							tsId, ub, allowStart, mngId, (pageno - 1) * arg30,
							arg30);
				}

				SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
				SimpleDateFormat sfl = new SimpleDateFormat("yyyy-MM-dd HH:mm");
				ArrayList items = new ArrayList();

				for (int tmpList = 0; tmpList < list.size(); ++tmpList) {
					Object[] tsItems = (Object[]) list.get(tmpList);
					BusinessBill i = (BusinessBill) tsItems[0];
					String item = (String) tsItems[1];
					if (i.getLinkman() != null && !i.getLinkman().equals("")) {
						item = item + "(" + i.getLinkman() + ")";
					}

					HashMap ts = new HashMap();
					ts.put("cost", i.getCost());
					ts.put("examName", tsItems[2]);
					ts.put("examTime", sfl.format((Date) tsItems[3]));
					ts.put("estName", item);
					ts.put("id", Long.valueOf(i.getId()));
					ts.put("date", sf.format(i.getOrderDate()));
					items.add(ts);
				}

				map.put("items", items);
				if (initQuer != null && initQuer.equals("Y")) {
					List arg31 = PageHelper.getTallySetList(this.tallySetDao,
							ub);
					ArrayList arg32 = new ArrayList();

					for (int arg33 = 0; arg33 < arg31.size(); ++arg33) {
						HashMap arg34 = new HashMap();
						TallySet arg35 = (TallySet) arg31.get(arg33);
						arg34.put("id", Long.valueOf(arg35.getId()));
						arg34.put("name", arg35.getTitle());
						arg32.add(arg34);
					}

					map.put("tsItems", arg32);
				}

				map.put("status", "OK");
				map.put("errMsg", "");
			} catch (Exception arg27) {
				map.put("status", "ERROR");
				map.put("errMsg", arg27.toString());
			}
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg28 = new ObjectMapper();
		json = arg28.writeValueAsString(map);
		ServletOutputStream arg29 = response.getOutputStream();
		arg29.write(json.getBytes("utf-8"));
		arg29.flush();
		arg29.close();
		return null;
	}

	public ModelAndView handleAppExam(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		UserStatus s = EncInterceptorHelper.checkAppUserSignon(request);
		UserBean ub = s.getUserBean();
		String status = "";
		String errMsg = "";
		if (ub == null) {
			status = "NO_LOGIN";
		} else {
			String map = request.getParameter("type");
			String mapper = request.getParameter("id");
			if (map != null && map.equals("UNEXAM")) {
				if (!EncCommonHelper.checkPrivilege(request, "BUSI_UN_EXAM")) {
					status = "ERROR";
					errMsg = "您还没有此功能的使用权限，请确认返回！";
				} else {
					try {
						this.businessBillService.txUnExamine(
								Long.parseLong(mapper),
								this.businessBillItemDao,
								this.bankAccountBalanceDao,
								this.bankAccountDetailDao,
								this.financeDetailDao, this.idGenerator, ub);
						status = "OK";
					} catch (CannotAcquireLockException arg18) {
						status = "ERROR";
						errMsg = "事务冲突故障，请重新操作！";
					} catch (NotAllowException arg19) {
						status = "ERROR";
						errMsg = arg19.getMessage();
					}
				}
			} else if (!EncCommonHelper.checkPrivilege(request, "BUSI_EXAM")) {
				status = "ERROR";
				errMsg = "您还没有此功能的使用权限，请确认返回！";
			} else {
				boolean json = false;
				if (EncCommonHelper.checkPurePrivilege(request, "NO_EXAM_OTHE")) {
					json = true;
				}

				boolean out = false;
				String customTxt = "";
				EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
				SmsAlert sa = this.smsAlertDao.get("BUS_CLIE");
				if (sa != null && sa.getStatus() != null
						&& sa.getStatus().equals("Y")) {
					out = true;
					customTxt = sa.getCustomTxt();
				}

				try {
					Map w = this.businessBillService.txExamine(Long
							.parseLong(mapper), json, this.businessBillDao,
							this.businessBillItemDao, this.receiveBillDao,
							this.adjustBillDao, ub.getStaffer().getId(), ub
									.getStaffer().getStafferName(),
							this.bankAccountBalanceDao, this.cooperBillItemDao,
							this.feeBillDao, this.stockDao, this.idGenerator);
					status = "OK";
					if (w.get("exam") != null) {
						try {
							if (out) {
								PageHelper.sendBusClieSms(w, customTxt,
										ent.getShortName(), this.stafferDao,
										this.idGenerator);
							}
						} catch (Exception arg15) {
							arg15.printStackTrace();
						}
					}
				} catch (NotAllowException arg16) {
					status = "ERROR";
					errMsg = arg16.getMessage();
				} catch (CannotAcquireLockException arg17) {
					status = "ERROR";
					errMsg = "事务冲突故障，请重新操作！";
				}
			}
		}

		HashMap map1 = new HashMap();
		map1.put("status", status);
		map1.put("errMsg", errMsg);
		ObjectMapper mapper1 = new ObjectMapper();
		String json1 = mapper1.writeValueAsString(map1);
		ServletOutputStream out1 = response.getOutputStream();
		out1.write(json1.getBytes("utf-8"));
		out1.flush();
		out1.close();
		return null;
	}

	public ModelAndView handleAppEditList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HashMap map = new HashMap();
		UserStatus s = EncInterceptorHelper.checkAppUserSignon(request);
		UserBean ub = s.getUserBean();
		String json;
		if (ub == null) {
			map.put("status", "NO_LOGIN");
			map.put("errMsg", "");
		} else if (!EncCommonHelper.checkPrivilege(request, "BUSI_LOG")) {
			map.put("status", "ERROR");
			map.put("errMsg", "您还没有此功能的使用权限，请确认返回！");
		} else {
			try {
				String mapper = request.getParameter("start_date");
				json = request.getParameter("end_date");
				String out = request.getParameter("est_name");
				String creaName = request.getParameter("crea_name");
				String tsIdStr = request.getParameter("ts_id");
				String showPrev = request.getParameter("show_prev");
				String initQuer = request.getParameter("init_quer");
				long tsId = 0L;
				if (tsIdStr != null && !tsIdStr.equals("")) {
					tsId = Long.parseLong(tsIdStr);
				}

				Date startDate = null;
				Date endDate = null;
				SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
				SimpleDateFormat sfl = new SimpleDateFormat("yyyy-MM-dd HH:mm");
				if (mapper != null && !mapper.equals("")) {
					startDate = sf.parse(mapper);
				}

				if (json != null && !json.equals("")) {
					endDate = sf.parse(EncCommonHelper.getNextDateStr(json,
							"yyyy-MM-dd"));
				}

				int total = this.businessBillDao.getAppEditListCount(startDate,
						endDate, out, creaName, tsId, ub);
				int perPageNum = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						total, perPageNum);
				if (total > pageno * perPageNum) {
					map.put("more", "Y");
				} else {
					map.put("more", "N");
				}

				map.put("total", Integer.valueOf(total));
				List list;
				if (showPrev != null && showPrev.equals("Y")) {
					list = this.businessBillDao.getAppEditList(startDate,
							endDate, out, creaName, tsId, ub, 0, pageno
									* perPageNum);
				} else {
					list = this.businessBillDao.getAppEditList(startDate,
							endDate, out, creaName, tsId, ub, (pageno - 1)
									* perPageNum, perPageNum);
				}

				ArrayList items = new ArrayList();

				for (int tmpList = 0; tmpList < list.size(); ++tmpList) {
					HashMap tsItems = new HashMap();
					Object[] i = (Object[]) list.get(tmpList);
					BusinessUpdateLog item = (BusinessUpdateLog) i[0];
					String ts = (String) i[1];
					String date = "";
					String code = "";
					String ba = "";
					String impr = "";
					String fav = "";
					String cost = "";
					if (item.getOrderDate() != null) {
						date = item.getOrderDate();
					}

					if (item.getCode() != null) {
						code = item.getCode();
					}

					if (item.getBackAccount() != null) {
						ba = item.getBackAccount();
					}

					if (item.getImprest() != null) {
						impr = item.getImprest();
					}

					if (item.getFavCost() != null) {
						fav = item.getFavCost();
					}

					if (item.getCost() != null) {
						cost = item.getCost();
					}

					tsItems.put("billId", Long.valueOf(item.getBillId()));
					tsItems.put("estName", ts);
					tsItems.put("date", date);
					tsItems.put("code", code);
					tsItems.put("ba", ba);
					tsItems.put("impr", impr);
					tsItems.put("fav", fav);
					tsItems.put("cost", cost);
					tsItems.put("creaName", item.getUpdateName());
					tsItems.put("creaTime", sfl.format(item.getUpdateDate()));
					items.add(tsItems);
				}

				map.put("items", items);
				if (initQuer != null && initQuer.equals("Y")) {
					List arg37 = PageHelper.getTallySetList(this.tallySetDao,
							ub);
					ArrayList arg38 = new ArrayList();

					for (int arg39 = 0; arg39 < arg37.size(); ++arg39) {
						HashMap arg40 = new HashMap();
						TallySet arg41 = (TallySet) arg37.get(arg39);
						arg40.put("id", Long.valueOf(arg41.getId()));
						arg40.put("name", arg41.getTitle());
						arg38.add(arg40);
					}

					map.put("tsItems", arg38);
				}

				map.put("status", "OK");
				map.put("errMsg", "");
			} catch (Exception arg34) {
				map.put("status", "ERROR");
				map.put("errMsg", arg34.toString());
			}
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg35 = new ObjectMapper();
		json = arg35.writeValueAsString(map);
		ServletOutputStream arg36 = response.getOutputStream();
		arg36.write(json.getBytes("utf-8"));
		arg36.flush();
		arg36.close();
		return null;
	}

	public ModelAndView handleAppBusiDateCoun(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HashMap map = new HashMap();
		UserStatus s = EncInterceptorHelper.checkAppUserSignon(request);
		UserBean ub = s.getUserBean();
		String json;
		if (ub == null) {
			map.put("status", "NO_LOGIN");
			map.put("errMsg", "");
		} else if (!EncCommonHelper.checkPrivilege(request, "BUSI_DATE_COUN")) {
			map.put("status", "ERROR");
			map.put("errMsg", "您还没有此功能的使用权限，请确认返回！");
		} else {
			try {
				String mapper = request.getParameter("start_date");
				json = request.getParameter("end_date");
				String out = request.getParameter("ts_id");
				String initQuer = request.getParameter("init_quer");
				long mngId = 0L;
				long tsId = 0L;
				if (out != null && !out.equals("")) {
					tsId = Long.parseLong(out);
				}

				if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
					mngId = ub.getStaffer().getId();
				}

				Date allowStart = null;
				Date startDate = null;
				Date endDate = null;
				if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
					allowStart = EncCommonHelper.getEarlDataDate(request);
				}

				SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
				if (mapper != null && !mapper.equals("")) {
					startDate = sf.parse(mapper);
				}

				if (json != null && !json.equals("")) {
					endDate = sf.parse(EncCommonHelper.getNextDateStr(json,
							"yyyy-MM-dd"));
				}

				if (startDate == null) {
					startDate = allowStart;
				} else if (allowStart != null && allowStart.after(startDate)) {
					startDate = allowStart;
				}

				int busiCoun = 0;
				BigDecimal busiCost = new BigDecimal(0);
				List list = this.businessBillDao.getAppBusiDateCoun(startDate,
						endDate, tsId, ub, mngId);
				if (!list.isEmpty() && list.get(0) != null) {
					Object[] imprCoun = (Object[]) list.get(0);
					if (imprCoun[0] != null) {
						busiCoun = Integer.parseInt(imprCoun[0].toString());
					}

					if (imprCoun[1] != null) {
						busiCost = (BigDecimal) imprCoun[1];
					}
				}

				int arg34 = 0;
				BigDecimal imprCost = new BigDecimal(0);
				list = this.businessBillDao.getAppBusiDateCounImpr(startDate,
						endDate, tsId, ub, mngId);
				if (!list.isEmpty() && list.get(0) != null) {
					Object[] receCoun = (Object[]) list.get(0);
					if (receCoun[0] != null) {
						arg34 = Integer.parseInt(receCoun[0].toString());
					}

					if (receCoun[1] != null) {
						imprCost = (BigDecimal) receCoun[1];
					}
				}

				int arg35 = 0;
				BigDecimal receCost = new BigDecimal(0);
				list = this.receiveBillDao.getAppBusiDateCoun(startDate,
						endDate, tsId, ub, mngId);
				if (!list.isEmpty() && list.get(0) != null) {
					Object[] remCost = (Object[]) list.get(0);
					if (remCost[0] != null) {
						arg35 = Integer.parseInt(remCost[0].toString());
					}

					if (remCost[1] != null) {
						receCost = (BigDecimal) remCost[1];
					}
				}

				BigDecimal arg36 = busiCost.subtract(imprCost);
				BigDecimal backCost = imprCost.add(receCost);
				map.put("busiCoun", Integer.valueOf(busiCoun));
				map.put("busiCost", busiCost);
				map.put("remCost", arg36);
				map.put("backCost", backCost);
				map.put("imprCoun", Integer.valueOf(arg34));
				map.put("imprCost", imprCost);
				map.put("receCoun", Integer.valueOf(arg35));
				map.put("receCost", receCost);
				if (initQuer != null && initQuer.equals("Y")) {
					List tmpList = PageHelper.getTallySetList(this.tallySetDao,
							ub);
					ArrayList tsItems = new ArrayList();

					for (int i = 0; i < tmpList.size(); ++i) {
						HashMap item = new HashMap();
						TallySet ts = (TallySet) tmpList.get(i);
						item.put("id", Long.valueOf(ts.getId()));
						item.put("name", ts.getTitle());
						tsItems.add(item);
					}

					map.put("tsItems", tsItems);
				}

				map.put("status", "OK");
				map.put("errMsg", "");
			} catch (Exception arg31) {
				map.put("status", "ERROR");
				map.put("errMsg", arg31.toString());
			}
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg32 = new ObjectMapper();
		json = arg32.writeValueAsString(map);
		ServletOutputStream arg33 = response.getOutputStream();
		arg33.write(json.getBytes("utf-8"));
		arg33.flush();
		arg33.close();
		return null;
	}

	public ModelAndView handleAppEstBusiCoun(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HashMap map = new HashMap();
		UserStatus s = EncInterceptorHelper.checkAppUserSignon(request);
		UserBean ub = s.getUserBean();
		String json;
		if (ub == null) {
			map.put("status", "NO_LOGIN");
			map.put("errMsg", "");
		} else if (!EncCommonHelper.checkPrivilege(request, "CLIE_BUSI_COUN")) {
			map.put("status", "ERROR");
			map.put("errMsg", "您还没有此功能的使用权限，请确认返回！");
		} else {
			try {
				String mapper = request.getParameter("start_date");
				json = request.getParameter("end_date");
				String out = request.getParameter("est_name");
				String tsIdStr = request.getParameter("ts_id");
				String initQuer = request.getParameter("init_quer");
				long mngId = 0L;
				long tsId = 0L;
				if (tsIdStr != null && !tsIdStr.equals("")) {
					tsId = Long.parseLong(tsIdStr);
				}

				if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
					mngId = ub.getStaffer().getId();
				}

				Date allowStart = null;
				Date startDate = null;
				Date endDate = null;
				if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
					allowStart = EncCommonHelper.getEarlDataDate(request);
				}

				SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
				if (mapper != null && !mapper.equals("")) {
					startDate = sf.parse(mapper);
				}

				if (json != null && !json.equals("")) {
					endDate = sf.parse(EncCommonHelper.getNextDateStr(json,
							"yyyy-MM-dd"));
				}

				if (startDate == null) {
					startDate = allowStart;
				} else if (allowStart != null && allowStart.after(startDate)) {
					startDate = allowStart;
				}

				int total = 0;
				BigDecimal cost = new BigDecimal(0);
				BigDecimal remCost = new BigDecimal(0);
				List list = this.businessBillDao.getAppEstBusiCounTota(
						startDate, endDate, out, tsId, ub, mngId);
				if (!list.isEmpty() && list.get(0) != null) {
					Object[] perPageNum = (Object[]) list.get(0);
					if (perPageNum[0] != null) {
						total = Integer.parseInt(perPageNum[0].toString());
					}

					if (perPageNum[1] != null) {
						cost = (BigDecimal) perPageNum[1];
					}

					if (perPageNum[2] != null) {
						remCost = (BigDecimal) perPageNum[2];
					}
				}

				map.put("cost", cost);
				map.put("remCost", remCost);
				map.put("total", Integer.valueOf(total));
				int arg34 = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						total, arg34);
				if (total > pageno * arg34) {
					map.put("more", "Y");
				} else {
					map.put("more", "N");
				}

				list = this.businessBillDao.getAppEstBusiCoun(startDate,
						endDate, out, tsId, ub, mngId, (pageno - 1) * arg34,
						arg34);
				List areaList = this.areaDao.getList(false);
				ArrayList items = new ArrayList();

				for (int tmpList = 0; tmpList < list.size(); ++tmpList) {
					HashMap tsItems = new HashMap();
					Object[] i = (Object[]) list.get(tmpList);
					tsItems.put("estName", i[0]);
					tsItems.put("cost", i[1]);
					tsItems.put("adju", i[2]);
					tsItems.put("rece", i[3]);
					tsItems.put("rem", i[4]);
					tsItems.put("mng", i[5]);
					tsItems.put(
							"area",
							EncCommonHelper.getSimpleObjectName(areaList,
									Long.parseLong(i[6].toString())));
					tsItems.put("estId", i[7]);
					items.add(tsItems);
				}

				map.put("items", items);
				if (initQuer != null && initQuer.equals("Y")) {
					List arg35 = PageHelper.getTallySetList(this.tallySetDao,
							ub);
					ArrayList arg36 = new ArrayList();

					for (int arg37 = 0; arg37 < arg35.size(); ++arg37) {
						HashMap item = new HashMap();
						TallySet ts = (TallySet) arg35.get(arg37);
						item.put("id", Long.valueOf(ts.getId()));
						item.put("name", ts.getTitle());
						arg36.add(item);
					}

					map.put("tsItems", arg36);
				}

				map.put("status", "OK");
				map.put("errMsg", "");
			} catch (Exception arg31) {
				map.put("status", "ERROR");
				map.put("errMsg", arg31.toString());
			}
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg32 = new ObjectMapper();
		json = arg32.writeValueAsString(map);
		ServletOutputStream arg33 = response.getOutputStream();
		arg33.write(json.getBytes("utf-8"));
		arg33.flush();
		arg33.close();
		return null;
	}

	public ModelAndView handleAppEstUnRece(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HashMap map = new HashMap();
		UserStatus s = EncInterceptorHelper.checkAppUserSignon(request);
		UserBean ub = s.getUserBean();
		String json;
		if (ub == null) {
			map.put("status", "NO_LOGIN");
			map.put("errMsg", "");
		} else if (!EncCommonHelper.checkPrivilege(request, "CLIE_UN_RECE")) {
			map.put("status", "ERROR");
			map.put("errMsg", "您还没有此功能的使用权限，请确认返回！");
		} else {
			try {
				String mapper = request.getParameter("ct");
				json = request.getParameter("rt");
				String out = request.getParameter("est_name");
				String tsIdStr = request.getParameter("ts_id");
				String initQuer = request.getParameter("init_quer");
				long mngId = 0L;
				long tsId = 0L;
				if (tsIdStr != null && !tsIdStr.equals("")) {
					tsId = Long.parseLong(tsIdStr);
				}

				if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
					mngId = ub.getStaffer().getId();
				}

				Date allowStart = null;
				if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
					allowStart = EncCommonHelper.getEarlDataDate(request);
				}

				int total = 0;
				BigDecimal cost = new BigDecimal(0);
				List list = this.businessBillDao.getAppEstUnReceTota(out,
						mapper, json, tsId, ub, mngId, allowStart);
				if (!list.isEmpty() && list.get(0) != null) {
					Object[] perPageNum = (Object[]) list.get(0);
					if (perPageNum[0] != null) {
						total = Integer.parseInt(perPageNum[0].toString());
					}

					if (perPageNum[1] != null) {
						cost = (BigDecimal) perPageNum[1];
					}
				}

				map.put("cost", cost);
				map.put("total", Integer.valueOf(total));
				int arg31 = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						total, arg31);
				if (total > pageno * arg31) {
					map.put("more", "Y");
				} else {
					map.put("more", "N");
				}

				SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
				list = this.businessBillDao.getAppEstUnRece(out, mapper, json,
						tsId, ub, mngId, allowStart, (pageno - 1) * arg31,
						arg31);
				List areaList = this.areaDao.getList(false);
				ArrayList items = new ArrayList();

				for (int tmpList = 0; tmpList < list.size(); ++tmpList) {
					HashMap tsItems = new HashMap();
					Object[] i = (Object[]) list.get(tmpList);
					String item = "";
					if (i[3] != null) {
						item = sf.format((Date) i[3]);
					}

					tsItems.put("estName", i[0]);
					tsItems.put("cost", i[1]);
					tsItems.put("cred", i[2]);
					tsItems.put("busiTime", item);
					tsItems.put("mark", PageHelper.parseNull((String) i[4]));
					tsItems.put("mng", i[5]);
					tsItems.put(
							"area",
							EncCommonHelper.getSimpleObjectName(areaList,
									Long.parseLong(i[6].toString())));
					tsItems.put("estId", i[7]);
					items.add(tsItems);
				}

				map.put("items", items);
				if (initQuer != null && initQuer.equals("Y")) {
					List arg32 = PageHelper.getTallySetList(this.tallySetDao,
							ub);
					ArrayList arg33 = new ArrayList();

					for (int arg34 = 0; arg34 < arg32.size(); ++arg34) {
						HashMap arg35 = new HashMap();
						TallySet ts = (TallySet) arg32.get(arg34);
						arg35.put("id", Long.valueOf(ts.getId()));
						arg35.put("name", ts.getTitle());
						arg33.add(arg35);
					}

					map.put("tsItems", arg33);
				}

				map.put("status", "OK");
				map.put("errMsg", "");
			} catch (Exception arg28) {
				map.put("status", "ERROR");
				map.put("errMsg", arg28.toString());
			}
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg29 = new ObjectMapper();
		json = arg29.writeValueAsString(map);
		ServletOutputStream arg30 = response.getOutputStream();
		arg30.write(json.getBytes("utf-8"));
		arg30.flush();
		arg30.close();
		return null;
	}

	public ModelAndView handleAppEstBackCoun(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HashMap map = new HashMap();
		UserStatus s = EncInterceptorHelper.checkAppUserSignon(request);
		UserBean ub = s.getUserBean();
		String json;
		if (ub == null) {
			map.put("status", "NO_LOGIN");
			map.put("errMsg", "");
		} else if (!EncCommonHelper.checkPrivilege(request, "CLIE_BACK_COUN")) {
			map.put("status", "ERROR");
			map.put("errMsg", "您还没有此功能的使用权限，请确认返回！");
		} else {
			try {
				String mapper = request.getParameter("start_date");
				json = request.getParameter("end_date");
				String out = request.getParameter("est_name");
				String tsIdStr = request.getParameter("ts_id");
				String initQuer = request.getParameter("init_quer");
				long mngId = 0L;
				long tsId = 0L;
				if (tsIdStr != null && !tsIdStr.equals("")) {
					tsId = Long.parseLong(tsIdStr);
				}

				if (EncCommonHelper.checkPurePrivilege(request, "BUSI_SELF")) {
					mngId = ub.getStaffer().getId();
				}

				Date allowStart = null;
				Date startDate = null;
				Date endDate = null;
				if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
					allowStart = EncCommonHelper.getEarlDataDate(request);
				}

				SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
				if (mapper != null && !mapper.equals("")) {
					startDate = sf.parse(mapper);
				}

				if (json != null && !json.equals("")) {
					endDate = sf.parse(EncCommonHelper.getNextDateStr(json,
							"yyyy-MM-dd"));
				}

				if (startDate == null) {
					startDate = allowStart;
				} else if (allowStart != null && allowStart.after(startDate)) {
					startDate = allowStart;
				}

				int total = 0;
				BigDecimal cost = new BigDecimal(0);
				BigDecimal impr = new BigDecimal(0);
				BigDecimal rece = new BigDecimal(0);
				List list = this.financeDetailDao.getAppEstBackCounTota(
						startDate, endDate, out, tsId, ub, mngId);
				if (!list.isEmpty() && list.get(0) != null) {
					Object[] perPageNum = (Object[]) list.get(0);
					if (perPageNum[0] != null) {
						total = Integer.parseInt(perPageNum[0].toString());
					}

					if (perPageNum[1] != null) {
						cost = (BigDecimal) perPageNum[1];
					}

					if (perPageNum[2] != null) {
						impr = (BigDecimal) perPageNum[2];
					}

					if (perPageNum[3] != null) {
						rece = (BigDecimal) perPageNum[3];
					}
				}

				map.put("cost", cost);
				map.put("impr", impr);
				map.put("rece", rece);
				map.put("total", Integer.valueOf(total));
				int arg35 = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						total, arg35);
				if (total > pageno * arg35) {
					map.put("more", "Y");
				} else {
					map.put("more", "N");
				}

				list = this.financeDetailDao.getAppEstBackCoun(startDate,
						endDate, out, tsId, ub, mngId, (pageno - 1) * arg35,
						arg35);
				List areaList = this.areaDao.getList(false);
				ArrayList items = new ArrayList();

				for (int tmpList = 0; tmpList < list.size(); ++tmpList) {
					HashMap tsItems = new HashMap();
					Object[] i = (Object[]) list.get(tmpList);
					tsItems.put("estName", i[0]);
					tsItems.put("cost", i[1]);
					tsItems.put("impr", i[2]);
					tsItems.put("rece", i[3]);
					tsItems.put("mng", i[4]);
					tsItems.put(
							"area",
							EncCommonHelper.getSimpleObjectName(areaList,
									Long.parseLong(i[5].toString())));
					tsItems.put("estId", i[6]);
					items.add(tsItems);
				}

				map.put("items", items);
				if (initQuer != null && initQuer.equals("Y")) {
					List arg36 = PageHelper.getTallySetList(this.tallySetDao,
							ub);
					ArrayList arg37 = new ArrayList();

					for (int arg38 = 0; arg38 < arg36.size(); ++arg38) {
						HashMap item = new HashMap();
						TallySet ts = (TallySet) arg36.get(arg38);
						item.put("id", Long.valueOf(ts.getId()));
						item.put("name", ts.getTitle());
						arg37.add(item);
					}

					map.put("tsItems", arg37);
				}

				map.put("status", "OK");
				map.put("errMsg", "");
			} catch (Exception arg32) {
				map.put("status", "ERROR");
				map.put("errMsg", arg32.toString());
			}
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg33 = new ObjectMapper();
		json = arg33.writeValueAsString(map);
		ServletOutputStream arg34 = response.getOutputStream();
		arg34.write(json.getBytes("utf-8"));
		arg34.flush();
		arg34.close();
		return null;
	}

	public ModelAndView handleAppMtBusiDate(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HashMap map = new HashMap();
		UserStatus s = EncInterceptorHelper.checkAppUserSignon(request);
		UserBean ub = s.getUserBean();
		String json;
		if (ub == null) {
			map.put("status", "NO_LOGIN");
			map.put("errMsg", "");
		} else if (!EncCommonHelper.checkPrivilege(request, "MT_BUSI_DATE")) {
			map.put("status", "ERROR");
			map.put("errMsg", "您还没有此功能的使用权限，请确认返回！");
		} else {
			try {
				String mapper = request.getParameter("start_date");
				json = request.getParameter("end_date");
				String out = request.getParameter("ts_id");
				String initQuer = request.getParameter("init_quer");
				long tsId = 0L;
				if (out != null && !out.equals("")) {
					tsId = Long.parseLong(out);
				}

				Date allowStart = null;
				Date startDate = null;
				Date endDate = null;
				if (EncCommonHelper.checkPurePrivilege(request, "NO_EARL_DATA")) {
					allowStart = EncCommonHelper.getEarlDataDate(request);
				}

				SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
				if (mapper != null && !mapper.equals("")) {
					startDate = sf.parse(mapper);
				}

				if (json != null && !json.equals("")) {
					endDate = sf.parse(EncCommonHelper.getNextDateStr(json,
							"yyyy-MM-dd"));
				}

				if (startDate == null) {
					startDate = allowStart;
				} else if (allowStart != null && allowStart.after(startDate)) {
					startDate = allowStart;
				}

				new BigDecimal(0);
				BigDecimal fave = new BigDecimal(0);
				BigDecimal real = new BigDecimal(0);
				List list = this.businessBillDao.getMtBusinessDateCount(
						startDate, endDate, tsId, ub);
				if (!list.isEmpty() && list.get(0) != null) {
					Object[] mtList = (Object[]) list.get(0);
					if (mtList[0] != null) {
						fave = (BigDecimal) mtList[0];
					}

					if (mtList[1] != null) {
						real = (BigDecimal) mtList[1];
					}
				}

				BigDecimal busi = fave.add(real);
				map.put("busi", busi);
				map.put("fave", fave);
				map.put("real", real);
				List arg35 = this.makeTypeDao.getList(false);
				list = this.businessBillDao.getMtBusinessDate(startDate,
						endDate, tsId, ub);
				List arr = this.parseMtBusinessDate(arg35, list);
				int total = arr.size();
				int perPageNum = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						total, perPageNum);
				if (total > pageno * perPageNum) {
					map.put("more", "Y");
				} else {
					map.put("more", "N");
				}

				int startIndex = (pageno - 1) * perPageNum;
				int endIndex = pageno * perPageNum;
				ArrayList items = new ArrayList();

				for (int tmpList = 0; tmpList < arr.size(); ++tmpList) {
					if (tmpList >= startIndex && tmpList < endIndex) {
						HashMap tsItems = new HashMap();
						Object[] i = (Object[]) arr.get(tmpList);
						String item = "";
						if (i[0] == null) {
							item = "无项目类型";
						} else {
							item = ((MakeType) i[0]).getTypeName();
						}

						tsItems.put("mtName", item);
						tsItems.put("amou", i[1]);
						tsItems.put("cost", i[2]);
						tsItems.put("laye", i[3]);
						items.add(tsItems);
					}
				}

				map.put("items", items);
				if (initQuer != null && initQuer.equals("Y")) {
					List arg36 = PageHelper.getTallySetList(this.tallySetDao,
							ub);
					ArrayList arg37 = new ArrayList();

					for (int arg38 = 0; arg38 < arg36.size(); ++arg38) {
						HashMap arg39 = new HashMap();
						TallySet ts = (TallySet) arg36.get(arg38);
						arg39.put("id", Long.valueOf(ts.getId()));
						arg39.put("name", ts.getTitle());
						arg37.add(arg39);
					}

					map.put("tsItems", arg37);
				}

				map.put("status", "OK");
				map.put("errMsg", "");
			} catch (Exception arg32) {
				map.put("status", "ERROR");
				map.put("errMsg", arg32.toString());
			}
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg33 = new ObjectMapper();
		json = arg33.writeValueAsString(map);
		ServletOutputStream arg34 = response.getOutputStream();
		arg34.write(json.getBytes("utf-8"));
		arg34.flush();
		arg34.close();
		return null;
	}

	public ModelAndView handleAppReliList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HashMap map = new HashMap();
		UserStatus s = EncInterceptorHelper.checkAppUserSignon(request);
		UserBean ub = s.getUserBean();
		if (ub == null) {
			map.put("status", "NO_LOGIN");
			map.put("errMsg", "");
		} else if (!EncCommonHelper.checkPrivilege(request, "BUSI_BILL_SEAR")) {
			map.put("status", "ERROR");
			map.put("errMsg", "您还没有此功能的使用权限，请确认返回！");
		} else {
			try {
				String mapper = request.getParameter("bill_code");
				BusinessBill json = this.businessBillDao.get(mapper);
				if (json != null) {
					SimpleDateFormat out = new SimpleDateFormat("yyyy-MM-dd");
					SimpleDateFormat longSf = new SimpleDateFormat(
							"yyyy-MM-dd HH:mm");
					String estName = "";
					String creaTime = "";
					String examName = "";
					String examTime = "";
					String closName = "";
					String closTime = "";
					Establishment est = (Establishment) this.businessBillDao
							.get(Establishment.class, json.getClientId());
					if (est != null) {
						estName = est.getEstName();
					}

					if (json.getCreateTime() != null) {
						creaTime = longSf.format(json.getCreateTime());
					}

					BusinessBillExt be = (BusinessBillExt) this.businessBillDao
							.get(BusinessBillExt.class, json.getId());
					if (be.getExamined().equals("Y")) {
						examName = be.getExaminerName();
						examTime = longSf.format(be.getExamineTime());
						if (be.getClosed().equals("Y")) {
							closName = be.getCloserName();
							closTime = longSf.format(be.getCloseTime());
						}
					}

					map.put("billId", String.valueOf(json.getId()));
					map.put("billCode", json.getBillCode());
					map.put("estName", estName);
					map.put("lm", PageHelper.parseNull(json.getLinkman()));
					map.put("mngName",
							PageHelper.parseNull(json.getManagerName()));
					map.put("follName",
							PageHelper.parseNull(json.getFollowerNameStr()));
					map.put("desiName",
							PageHelper.parseNull(json.getDesignerNameStr()));
					map.put("creaName",
							PageHelper.parseNull(json.getCreaterName()));
					map.put("creaTime", creaTime);
					map.put("examName", examName);
					map.put("examTime", examTime);
					map.put("closName", closName);
					map.put("closTime", closTime);
					String showRece = "N";
					String showAdju = "N";
					String showCoop = "N";
					String showFee = "N";
					if (EncCommonHelper.checkPrivilege(request,
							"RECE_BILL_SEAR")) {
						showRece = "Y";
					}

					if (EncCommonHelper.checkPrivilege(request,
							"ADJU_BILL_SEAR")) {
						showAdju = "Y";
					}

					if (EncCommonHelper.checkPrivilege(request,
							"COOP_BILL_SEAR")) {
						showCoop = "Y";
					}

					if (EncCommonHelper
							.checkPrivilege(request, "FEE_BILL_SEAR")) {
						showFee = "Y";
					}

					map.put("showRece", showRece);
					map.put("showAdju", showAdju);
					map.put("showCoop", showCoop);
					map.put("showFee", showFee);
					List list = this.businessBillItemDao.getListWidthExt(json
							.getId());
					List mtList = this.makeTypeDao.getList(false);
					List procList = this.workProcessDao.getList(0L, false);
					ArrayList arr = new ArrayList();

					int i;
					Object[] objs;
					String examStat;
					String feeCreaTime;
					String item;
					String deliCreaTime;
					for (i = 0; i < list.size(); ++i) {
						objs = (Object[]) list.get(i);
						BusinessBillItem bi = (BusinessBillItem) objs[0];
						BusinessBillItemExt exam = (BusinessBillItemExt) objs[1];
						examStat = "";
						feeCreaTime = "";
						item = "";
						deliCreaTime = "";
						BigDecimal item1 = new BigDecimal(0);
						if (bi.getPriceType().equals("AMOUNT")) {
							examStat = PageHelper.parseNull(bi.getUnit());
							item1 = bi.getAmount();
						} else if (bi.getPriceType().equals("AREA")) {
							examStat = "平方米";
							item1 = bi.getSquareNum();
						} else if (bi.getPriceType().equals("LENGTH")) {
							if (bi.getLengType().equals("M")) {
								examStat = "米";
							} else if (bi.getLengType().equals("CM")) {
								examStat = "公分";
							}

							item1 = bi.getSquareNum();
						}

						if (bi.getWcId() == 0L && bi.getIsCoop().equals("N")) {
							if (be.getExamined().equals("Y")) {
								feeCreaTime = "已完工";
							} else {
								feeCreaTime = "未完工";
							}
						} else {
							if (bi.getWcId() != 0L) {
								if (exam.getWcComp().equals("Y")) {
									feeCreaTime = "自制已完";
								} else {
									feeCreaTime = "自制未完";
								}
							}

							if (bi.getIsCoop().equals("Y")) {
								if (!feeCreaTime.equals("")) {
									feeCreaTime = feeCreaTime + " ";
								}

								if (exam.getCoopComp().equals("Y")) {
									feeCreaTime = feeCreaTime + "外协已完";
								} else {
									feeCreaTime = feeCreaTime + "外协未完";
								}
							}
						}

						if (exam.getOperName() != null) {
							item = exam.getOperName();
						}

						if (exam.getOperTime() != null) {
							deliCreaTime = longSf.format(exam.getOperTime());
						}

						HashMap item2 = new HashMap();
						item2.put(
								"mtName",
								EncCommonHelper.getSimpleObjectName(mtList,
										bi.getMakeTypeId()));
						item2.put("cont",
								PageHelper.parseNull(bi.getFinishedContent()));
						item2.put("prodName",
								PageHelper.parseNull(bi.getProName()));
						item2.put("spec",
								PageHelper.parseNull(bi.getSpecification()));
						item2.put("amou",
								EncCommonHelper.parseBigDecimal(item1));
						item2.put("unit", examStat);
						item2.put("procName", EncCommonHelper
								.getSimpleObjectName(procList, bi.getProId()));
						item2.put("compStat", feeCreaTime);
						item2.put("operName", item);
						item2.put("operTime", deliCreaTime);
						arr.add(item2);
					}

					map.put("items", arr);
					list = this.deliverBillDao.getListByBusinessBill(json
							.getId());
					arr = new ArrayList();

					String arg42;
					String arg45;
					for (i = 0; i < list.size(); ++i) {
						DeliverBill arg39 = (DeliverBill) list.get(i);
						arg42 = "未审核";
						arg45 = "未送货";
						examStat = "N";
						feeCreaTime = "";
						item = "";
						deliCreaTime = "";
						if (arg39.getExamined().equals("Y")) {
							arg42 = "已审核";
							if (arg39.getSended().equals("Y")) {
								arg45 = "已送货";
								examStat = "Y";
								feeCreaTime = PageHelper.parseNull(arg39
										.getSenderName());
								if (arg39.getSendTime() != null) {
									item = longSf.format(arg39.getSendTime());
								}
							}
						}

						if (arg39.getCreateTime() != null) {
							deliCreaTime = longSf.format(arg39.getCreateTime());
						}

						HashMap arg52 = new HashMap();
						arg52.put("billDate",
								out.format(arg39.getDeliverDate()));
						arg52.put("billCode", arg39.getBillCode());
						arg52.put("deliComp",
								PageHelper.parseNull(arg39.getDeliComp()));
						arg52.put("deliCode",
								PageHelper.parseNull(arg39.getDeliCode()));
						arg52.put("examStat", arg42);
						arg52.put("creaName", arg39.getCreaterName());
						arg52.put("creaTime", deliCreaTime);
						arg52.put("sendStat", arg45);
						arg52.put("sendName", feeCreaTime);
						arg52.put("sendTime", item);
						arg52.put("sendFlag", examStat);
						arg52.put("id", Long.valueOf(arg39.getId()));
						arr.add(arg52);
					}

					map.put("delis", arr);
					list = this.setuBillDao.getListByBusinessBill(json.getId());
					arr = new ArrayList();

					HashMap arg49;
					for (i = 0; i < list.size(); ++i) {
						SetuBill arg40 = (SetuBill) list.get(i);
						arg42 = "未审核";
						arg45 = "";
						if (arg40.getExam().equals("Y")) {
							arg42 = "已审核";
						}

						if (arg40.getCreaTime() != null) {
							arg45 = longSf.format(arg40.getCreaTime());
						}

						arg49 = new HashMap();
						arg49.put("billDate", out.format(arg40.getBillDate()));
						arg49.put("billCode", arg40.getBillCode());
						arg49.put("examStat", arg42);
						arg49.put("creaName", arg40.getCreaName());
						arg49.put("creaTime", arg45);
						arg49.put("id", Long.valueOf(arg40.getId()));
						arr.add(arg49);
					}

					map.put("setus", arr);
					list = this.receiveBillDao.getListByBusinessBill(json
							.getId());
					arr = new ArrayList();

					for (i = 0; i < list.size(); ++i) {
						ReceiveBill arg41 = (ReceiveBill) list.get(i);
						arg42 = "未审核";
						arg45 = "";
						if (arg41.getExamined().equals("Y")) {
							arg42 = "已审核";
						}

						if (arg41.getCreateTime() != null) {
							arg45 = longSf.format(arg41.getCreateTime());
						}

						arg49 = new HashMap();
						arg49.put("billDate",
								out.format(arg41.getReceiveDate()));
						arg49.put("billCode", arg41.getBillCode());
						arg49.put("examStat", arg42);
						arg49.put("creaName", arg41.getCreaterName());
						arg49.put("creaTime", arg45);
						arg49.put("id", Long.valueOf(arg41.getId()));
						arr.add(arg49);
					}

					map.put("reces", arr);
					list = this.adjustBillDao.getList("BUSINESS_BILL",
							json.getId());
					arr = new ArrayList();

					for (i = 0; i < list.size(); ++i) {
						AdjustBill arg43 = (AdjustBill) list.get(i);
						arg42 = "未审核";
						if (arg43.getExamined().equals("Y")) {
							arg42 = "已审核";
						}

						HashMap arg47 = new HashMap();
						arg47.put("billDate", out.format(arg43.getAdjustDate()));
						arg47.put("billCode", arg43.getBillCode());
						arg47.put("examStat", arg42);
						arg47.put("creaName", arg43.getCreaterName());
						arg47.put("creaTime",
								longSf.format(arg43.getCreateTime()));
						arg47.put("id", Long.valueOf(arg43.getId()));
						arr.add(arg47);
					}

					map.put("adjus", arr);
					list = this.cooperBillDao.getListByBusinessBill(json
							.getId());
					arr = new ArrayList();

					HashMap arg50;
					for (i = 0; i < list.size(); ++i) {
						objs = (Object[]) list.get(i);
						CooperBill arg48 = (CooperBill) objs[0];
						arg45 = (String) objs[1];
						examStat = "未审核";
						feeCreaTime = "";
						if (arg45.equals("Y")) {
							examStat = "已审核";
						}

						if (arg48.getCreateTime() != null) {
							feeCreaTime = longSf.format(arg48.getCreateTime());
						}

						arg50 = new HashMap();
						arg50.put("billDate", out.format(arg48.getCooperDate()));
						arg50.put("billCode", arg48.getBillCode());
						arg50.put("examStat", examStat);
						arg50.put("creaName", arg48.getCreaterName());
						arg50.put("creaTime", feeCreaTime);
						arg50.put("id", Long.valueOf(arg48.getId()));
						arr.add(arg50);
					}

					map.put("coops", arr);
					list = this.cooperBillDao.getGathListByBusinessBill(json
							.getId());
					arr = new ArrayList();

					for (i = 0; i < list.size(); ++i) {
						GatherBill arg44 = (GatherBill) list.get(i);
						arg42 = "未审核";
						arg45 = "";
						if (arg44.getExamined().equals("Y")) {
							arg42 = "已审核";
						}

						if (arg44.getCreateTime() != null) {
							arg45 = longSf.format(arg44.getCreateTime());
						}

						arg49 = new HashMap();
						arg49.put("billDate", out.format(arg44.getGatherDate()));
						arg49.put("billCode", arg44.getBillCode());
						arg49.put("examStat", arg42);
						arg49.put("creaName", arg44.getCreaterName());
						arg49.put("creaTime", arg45);
						arg49.put("id", Long.valueOf(arg44.getId()));
						arr.add(arg49);
					}

					map.put("gaths", arr);
					list = this.outBillDao.getListByBusinessBill(json
							.getBillCode());
					arr = new ArrayList();

					for (i = 0; i < list.size(); ++i) {
						OutBill arg46 = (OutBill) list.get(i);
						arg42 = "未审核";
						arg45 = "";
						if (arg46.getExamined().equals("Y")) {
							arg42 = "已审核";
						}

						if (arg46.getCreateTime() != null) {
							arg45 = longSf.format(arg46.getCreateTime());
						}

						arg49 = new HashMap();
						arg49.put("billDate", out.format(arg46.getOutDate()));
						arg49.put("billCode", arg46.getBillCode());
						arg49.put("examStat", arg42);
						arg49.put("creaName", arg46.getCreaterName());
						arg49.put("creaTime", arg45);
						arg49.put("id", Long.valueOf(arg46.getId()));
						arr.add(arg49);
					}

					map.put("outs", arr);
					list = this.feeBillDao.getListForBusinessBill(json.getId(),
							false);
					arr = new ArrayList();

					for (i = 0; i < list.size(); ++i) {
						objs = (Object[]) list.get(i);
						FeeBillItem arg51 = (FeeBillItem) objs[0];
						arg45 = (String) objs[6];
						examStat = "未审核";
						feeCreaTime = "";
						if (arg45.equals("Y")) {
							examStat = "已审核";
						}

						if (objs[7] != null) {
							feeCreaTime = longSf.format((Date) objs[7]);
						}

						arg50 = new HashMap();
						arg50.put("billDate", out.format((Date) objs[1]));
						arg50.put("billCode", (String) objs[2]);
						arg50.put("examStat", examStat);
						arg50.put("creaName", (String) objs[5]);
						arg50.put("creaTime", feeCreaTime);
						arg50.put("id", Long.valueOf(arg51.getBillId()));
						arr.add(arg50);
					}

					map.put("fees", arr);
					map.put("status", "OK");
					map.put("errMsg", "");
				} else {
					map.put("status", "ERROR");
					map.put("errMsg", "系统不能识别这个条形码：" + mapper);
				}
			} catch (Exception arg35) {
				map.put("status", "ERROR");
				map.put("errMsg", arg35.toString());
			}
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg36 = new ObjectMapper();
		String arg37 = arg36.writeValueAsString(map);
		ServletOutputStream arg38 = response.getOutputStream();
		arg38.write(arg37.getBytes("utf-8"));
		arg38.flush();
		arg38.close();
		return null;
	}

	public ModelAndView handleAppInfoByCode(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HashMap map = new HashMap();

		try {
			String mapper = request.getParameter("bill_code");
			BusinessBill json = this.businessBillDao.get(mapper);
			if (json == null) {
				map.put("status", "NOT_FOUND");
				map.put("errMsg", "");
			} else {
				BusinessBillExt out = (BusinessBillExt) this.businessBillDao
						.get(BusinessBillExt.class, json.getId());
				Establishment est = (Establishment) this.businessBillDao.get(
						Establishment.class, json.getClientId());
				BigDecimal remaCost = json.getCost().add(out.getAdjustCost())
						.subtract(out.getCollectedCost());
				String estName = "";
				if (est != null) {
					estName = est.getEstName();
				}

				map.put("billCode", json.getBillCode());
				map.put("estName", PageHelper.parseNull(estName));
				map.put("lm", PageHelper.parseNull(json.getLinkman()));
				map.put("remaCost", remaCost);
				map.put("enabStat", out.getEnabled());
				map.put("examStat", out.getExamined());
				map.put("closStat", out.getClosed());
				map.put("status", "OK");
				map.put("errMsg", "");
			}
		} catch (Exception arg9) {
			map.put("status", "ERROR");
			map.put("errMsg", arg9.toString());
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper mapper1 = new ObjectMapper();
		String json1 = mapper1.writeValueAsString(map);
		ServletOutputStream out1 = response.getOutputStream();
		out1.write(json1.getBytes("utf-8"));
		out1.flush();
		out1.close();
		return null;
	}

	public ModelAndView handleImpoForm(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.impoFormView);
		mv.addObject("priceType", request.getParameter("price_type"));
		return mv;
	}

	public ModelAndView handleImpoItem(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String fileName = request.getParameter("file_name");
		String priceType = request.getParameter("price_type");
		File file = new File(this.getServletContext().getRealPath(fileName));
		String alertMsg = "";
		Document doc = DocumentHelper.createDocument();
		Element root = doc.addElement("body");
		String mtName = "";
		String cont = "";
		String prodName = "";
		String amouStr = "";
		String pricStr = "";
		String mr = "";
		String spec = "";
		String unit = "";
		String lengStr = "";
		String widtStr = "";
		String lengType = "";
		List wcList = this.workCenterDao.getList(false);
		BufferedInputStream in = null;

		try {
			in = new BufferedInputStream(new FileInputStream(file));
			HSSFWorkbook format = new HSSFWorkbook(new POIFSFileSystem(in));

			for (int i = 0; i < format.getNumberOfSheets(); ++i) {
				HSSFSheet arg84 = format.getSheetAt(i);

				for (int j = 4; j < arg84.getPhysicalNumberOfRows(); ++j) {
					HSSFRow output = arg84.getRow(j);
					if (output == null || this.isMergedRegion(arg84, j, 0)) {
						break;
					}

					boolean hasInput = false;
					HSSFCell cell;
					if (priceType.equals("AMOUNT")) {
						cell = output.getCell(1);
						mtName = PageHelper.getCellVal(cell, 0);
						hasInput = hasInput || !PageHelper.isEmpty(mtName);
						cell = output.getCell(2);
						cont = PageHelper.getCellVal(cell, 5000);
						hasInput = hasInput || !PageHelper.isEmpty(cont);
						cell = output.getCell(3);
						prodName = PageHelper.getCellVal(cell, 100);
						hasInput = hasInput || !PageHelper.isEmpty(prodName);
						cell = output.getCell(4);
						spec = PageHelper.getCellVal(cell, 250);
						hasInput = hasInput || !PageHelper.isEmpty(spec);
						cell = output.getCell(5);
						amouStr = PageHelper.getCellVal(cell, 0);
						hasInput = hasInput || !PageHelper.isEmpty(amouStr);
						cell = output.getCell(6);
						unit = PageHelper.getCellVal(cell, 15);
						hasInput = hasInput || !PageHelper.isEmpty(unit);
						cell = output.getCell(7);
						pricStr = PageHelper.getCellVal(cell, 0);
						hasInput = hasInput || !PageHelper.isEmpty(pricStr);
						mr = this.getMergedRegionValue(arg84, j, 9, 500);
						hasInput = hasInput || !PageHelper.isEmpty(mr);
					} else if (priceType.equals("LENGTH")) {
						cell = output.getCell(1);
						mtName = PageHelper.getCellVal(cell, 0);
						hasInput = hasInput || !PageHelper.isEmpty(mtName);
						cell = output.getCell(2);
						cont = PageHelper.getCellVal(cell, 5000);
						hasInput = hasInput || !PageHelper.isEmpty(cont);
						cell = output.getCell(3);
						prodName = PageHelper.getCellVal(cell, 100);
						hasInput = hasInput || !PageHelper.isEmpty(prodName);
						cell = output.getCell(4);
						lengStr = PageHelper.getCellVal(cell, 0);
						hasInput = hasInput || !PageHelper.isEmpty(lengStr);
						cell = output.getCell(5);
						widtStr = PageHelper.getCellVal(cell, 0);
						hasInput = hasInput || !PageHelper.isEmpty(widtStr);
						cell = output.getCell(6);
						amouStr = PageHelper.getCellVal(cell, 0);
						hasInput = hasInput || !PageHelper.isEmpty(amouStr);
						cell = output.getCell(8);
						lengType = PageHelper.getCellVal(cell, 10);
						hasInput = hasInput || !PageHelper.isEmpty(lengType);
						cell = output.getCell(9);
						pricStr = PageHelper.getCellVal(cell, 0);
						hasInput = hasInput || !PageHelper.isEmpty(pricStr);
						mr = this.getMergedRegionValue(arg84, j, 11, 500);
						hasInput = hasInput || !PageHelper.isEmpty(mr);
					} else if (priceType.equals("AREA")) {
						cell = output.getCell(1);
						mtName = PageHelper.getCellVal(cell, 0);
						hasInput = hasInput || !PageHelper.isEmpty(mtName);
						cell = output.getCell(2);
						cont = PageHelper.getCellVal(cell, 5000);
						hasInput = hasInput || !PageHelper.isEmpty(cont);
						cell = output.getCell(3);
						prodName = PageHelper.getCellVal(cell, 100);
						hasInput = hasInput || !PageHelper.isEmpty(prodName);
						cell = output.getCell(4);
						lengStr = PageHelper.getCellVal(cell, 0);
						hasInput = hasInput || !PageHelper.isEmpty(lengStr);
						cell = output.getCell(5);
						widtStr = PageHelper.getCellVal(cell, 0);
						hasInput = hasInput || !PageHelper.isEmpty(widtStr);
						cell = output.getCell(6);
						lengType = PageHelper.getCellVal(cell, 10);
						hasInput = hasInput || !PageHelper.isEmpty(lengType);
						cell = output.getCell(7);
						amouStr = PageHelper.getCellVal(cell, 0);
						hasInput = hasInput || !PageHelper.isEmpty(amouStr);
						cell = output.getCell(9);
						pricStr = PageHelper.getCellVal(cell, 0);
						hasInput = hasInput || !PageHelper.isEmpty(pricStr);
						mr = this.getMergedRegionValue(arg84, j, 11, 500);
						hasInput = hasInput || !PageHelper.isEmpty(mr);
					}

					if (hasInput) {
						long mtId = 0L;
						long wcId = 0L;
						String wcName = "";
						String isCoop = "N";
						if (mtName != null && !mtName.equals("")) {
							MakeType prodId = this.makeTypeDao.getByName(
									mtName, true);
							if (prodId != null) {
								mtId = prodId.getId();
								wcId = prodId.getWorkCenterId();
								wcName = EncCommonHelper.getSimpleObjectName(
										wcList, wcId);
								if (prodId.getType() == 2) {
									isCoop = "Y";
								}
							}
						}

						if (mtId == 0L) {
							mtName = "";
						}

						long arg87 = 0L;
						if (prodName != null && !prodName.equals("")) {
							Product amou = this.productDao.getByName(prodName,
									true);
							if (amou != null) {
								arg87 = amou.getId();
							}
						}

						BigDecimal arg88 = new BigDecimal(0);

						try {
							arg88 = new BigDecimal(amouStr);
						} catch (Exception arg80) {
							;
						}

						BigDecimal up = new BigDecimal(0);

						try {
							up = new BigDecimal(pricStr);
						} catch (Exception arg79) {
							;
						}

						BigDecimal cost = new BigDecimal(0);
						BigDecimal leng = new BigDecimal(0);
						BigDecimal widt = new BigDecimal(0);
						BigDecimal squa = new BigDecimal(0);
						if (priceType.equals("AMOUNT")) {
							cost = arg88.multiply(up).setScale(2, 4);
						} else if (priceType.equals("LENGTH")) {
							try {
								leng = new BigDecimal(lengStr);
							} catch (Exception arg78) {
								;
							}

							try {
								widt = new BigDecimal(widtStr);
							} catch (Exception arg77) {
								;
							}

							EnterpriseInfo itemEl = EncCommonHelper
									.getEnterpriseInfo(request);
							if (itemEl.getBusiLengType().equals("WIDTH")) {
								squa = leng.multiply(arg88).setScale(2, 4);
							} else if (itemEl.getBusiLengType().equals("TALL")) {
								squa = widt.multiply(arg88).setScale(2, 4);
							} else if (leng.compareTo(widt) > 0) {
								squa = leng.multiply(arg88).setScale(2, 4);
							} else {
								squa = widt.multiply(arg88).setScale(2, 4);
							}

							if (lengType.equalsIgnoreCase("CM")) {
								lengType = "CM";
							} else {
								lengType = "M";
							}

							spec = EncCommonHelper.parseBigDecimal(leng)
									+ lengType.toLowerCase() + " x "
									+ EncCommonHelper.parseBigDecimal(widt)
									+ lengType.toLowerCase() + "高";
							cost = squa.multiply(up).setScale(2, 4);
						} else if (priceType.equals("AREA")) {
							try {
								leng = new BigDecimal(lengStr);
							} catch (Exception arg76) {
								;
							}

							try {
								widt = new BigDecimal(widtStr);
							} catch (Exception arg75) {
								;
							}

							squa = leng.multiply(widt).multiply(arg88);
							if (lengType.equalsIgnoreCase("MM")) {
								lengType = "MM";
								squa = squa.divide(new BigDecimal(1000000), 3,
										4);
							} else {
								lengType = "M";
								squa = squa.setScale(3, 4);
							}

							spec = EncCommonHelper.parseBigDecimal(leng)
									+ lengType.toLowerCase() + " x "
									+ EncCommonHelper.parseBigDecimal(widt)
									+ lengType.toLowerCase() + "高";
							cost = squa.multiply(up).setScale(2, 4);
						}

						Element arg89 = root.addElement("item");
						Element mtIdEl = arg89.addElement("mt_id");
						mtIdEl.setText(String.valueOf(mtId));
						Element mtNameEl = arg89.addElement("mt_name");
						mtNameEl.setText(mtName);
						Element proIdEl = arg89.addElement("pro_id");
						proIdEl.setText(String.valueOf(arg87));
						Element proNameEl = arg89.addElement("pro_name");
						proNameEl.setText(prodName);
						Element specEl = arg89.addElement("spec");
						specEl.setText(spec);
						Element contEl = arg89.addElement("cont");
						contEl.setText(cont);
						Element mrEl = arg89.addElement("mr");
						mrEl.setText(mr);
						Element unitEl = arg89.addElement("unit");
						unitEl.setText(unit);
						Element amouEl = arg89.addElement("amou");
						amouEl.setText(arg88.toString());
						Element upEl = arg89.addElement("up");
						upEl.setText(up.toString());
						Element costEl = arg89.addElement("cost");
						costEl.setText(cost.toString());
						Element wcIdEl = arg89.addElement("wc_id");
						wcIdEl.setText(String.valueOf(wcId));
						Element wcNameEl = arg89.addElement("wc_name");
						wcNameEl.setText(wcName);
						Element isCoopEl = arg89.addElement("is_coop");
						isCoopEl.setText(isCoop);
						Element lengEl = arg89.addElement("leng");
						lengEl.setText(EncCommonHelper.parseBigDecimal(leng));
						Element widtEl = arg89.addElement("widt");
						widtEl.setText(EncCommonHelper.parseBigDecimal(widt));
						Element squaEl = arg89.addElement("squa");
						squaEl.setText(EncCommonHelper.parseBigDecimal(squa));
						Element lengTypeEl = arg89.addElement("leng_type");
						lengTypeEl.setText(lengType);
					}
				}
			}
		} catch (Exception arg81) {
			alertMsg = "导入错误：" + arg81.getMessage();
			Element out = root.addElement("alert_msg");
			out.setText(alertMsg);
		} finally {
			try {
				if (in != null) {
					in.close();
				}
			} catch (Exception arg74) {
				;
			}

		}

		response.setContentType("text/xml");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		OutputFormat arg83 = OutputFormat.createPrettyPrint();
		arg83.setEncoding("utf-8");
		ServletOutputStream arg85 = response.getOutputStream();
		XMLWriter arg86 = new XMLWriter(arg85, arg83);
		arg86.write(doc);
		arg85.flush();
		arg85.close();
		return null;
	}

	private boolean isMergedRegion(HSSFSheet sheet, int row, int column) {
		int sheetMergeCount = sheet.getNumMergedRegions();

		for (int i = 0; i < sheetMergeCount; ++i) {
			Region range = sheet.getMergedRegionAt(i);
			short firstColumn = range.getColumnFrom();
			short lastColumn = range.getColumnTo();
			int firstRow = range.getRowFrom();
			int lastRow = range.getRowTo();
			if (row >= firstRow && row <= lastRow && column >= firstColumn
					&& column <= lastColumn) {
				return true;
			}
		}

		return false;
	}

	public String getMergedRegionValue(HSSFSheet sheet, int row, int column,
			int maxLen) {
		String retStr = "";
		boolean isMergedRegion = false;
		int sheetMergeCount = sheet.getNumMergedRegions();

		for (int frow = 0; frow < sheetMergeCount; ++frow) {
			Region fcell = sheet.getMergedRegionAt(frow);
			short firstColumn = fcell.getColumnFrom();
			short lastColumn = fcell.getColumnTo();
			int firstRow = fcell.getRowFrom();
			int lastRow = fcell.getRowTo();
			if (row >= firstRow && row <= lastRow && column >= firstColumn
					&& column <= lastColumn) {
				HSSFRow frow1 = sheet.getRow(firstRow);
				HSSFCell fcell1 = frow1.getCell((short) firstColumn);
				retStr = PageHelper.getCellVal(fcell1, maxLen);
				isMergedRegion = true;
				break;
			}
		}

		if (!isMergedRegion) {
			HSSFRow arg15 = sheet.getRow(row);
			HSSFCell arg16 = arg15.getCell((short) column);
			retStr = PageHelper.getCellVal(arg16, maxLen);
		}

		return retStr;
	}

	public ModelAndView handleAcceSear(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "ACCE_SEAR")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.acceSearView);
			List wcList = this.workCenterDao.getList(false);
			QueryParameterBean b = EncBusinessBillMACtrHelper.handleAcceSear(
					request, this.dataSource);
			QueryResult qr = this.queryDao.doQuery(b.getCurrentPage(),
					b.getPageSize(), b.getQParas(), b.getOParas(),
					(String[]) null, b.getShortNameMap(), b.getRetObjs(),
					(String[]) null);
			mv.addAllObjects(b.getParameters());
			mv.addObject("qr", qr);
			mv.addObject("wcList", wcList);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, ub));
			return mv;
		}
	}

	public ModelAndView handleBusiBillList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.busiBillListView);
		String startDateStr = request.getParameter("start_date");
		String endDateStr = request.getParameter("end_date");
		Date startDate = null;
		Date endDate = null;
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
		SimpleDateFormat monthSf = new SimpleDateFormat("yyyy-MM");
		Date now = new Date();
		if (startDateStr == null) {
			startDateStr = monthSf.format(now) + "-01";
			endDateStr = sf.format(now);
		}

		if (startDateStr != null && !startDateStr.equals("")) {
			startDate = sf.parse(startDateStr);
		}

		if (endDateStr != null && !endDateStr.equals("")) {
			endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
					"yyyy-MM-dd"));
		}

		ClieUserBean ub = EncCommonHelper.getClieUserAccount(request);
		int perPageNum = EncCommonHelper.getPageSize(request);
		int total = 0;
		List list = this.businessBillDao.getBusiListCount(ub.getUser()
				.getClieId(), startDate, endDate);
		BigDecimal costTotal = new BigDecimal(0);
		if (!list.isEmpty() && list.get(0) != null) {
			Object[] pageno = (Object[]) list.get(0);
			if (pageno[0] != null) {
				total = Integer.parseInt(pageno[0].toString());
			}

			if (pageno[1] != null) {
				costTotal = (BigDecimal) pageno[1];
			}
		}

		int pageno1 = EncCommonHelper.getCurrentPageIndex(request, total,
				perPageNum);
		int startIndex = (pageno1 - 1) * perPageNum;
		list = this.businessBillDao.getBusiList(ub.getUser().getClieId(),
				startDate, endDate, startIndex, perPageNum);
		mv.addObject("qr", EncCommonHelper.parseQueryResult(list, total,
				perPageNum, pageno1));
		mv.addObject("startDate", startDateStr);
		mv.addObject("endDate", endDateStr);
		mv.addObject("mtList", this.makeTypeDao.getList(false));
		mv.addObject("costTotal", costTotal);
		return mv;
	}

	public ModelAndView handleBusiCoun(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.busiCounView);
		ClieUserBean ub = EncCommonHelper.getClieUserAccount(request);
		BigDecimal busiCost = new BigDecimal(0);
		BigDecimal payCost = new BigDecimal(0);
		BigDecimal adjuCost = new BigDecimal(0);
		BigDecimal remaCost = new BigDecimal(0);
		List list = this.businessBillDao.getBusiCoun(ub.getUser().getClieId());
		if (!list.isEmpty() && list.get(0) != null) {
			Object[] objs = (Object[]) list.get(0);
			if (objs[0] != null) {
				busiCost = (BigDecimal) objs[0];
				adjuCost = (BigDecimal) objs[1];
				payCost = (BigDecimal) objs[2];
				remaCost = (BigDecimal) objs[3];
			}
		}

		mv.addObject("busiCost", busiCost);
		mv.addObject("payCost", payCost);
		mv.addObject("adjuCost", adjuCost);
		mv.addObject("remaCost", (new BigDecimal(0)).subtract(remaCost));
		return mv;
	}

	public ModelAndView handlePayList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.payListView);
		String startDateStr = request.getParameter("start_date");
		String endDateStr = request.getParameter("end_date");
		Date startDate = null;
		Date endDate = null;
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
		if (startDateStr != null && !startDateStr.equals("")) {
			startDate = sf.parse(startDateStr);
		}

		if (endDateStr != null && !endDateStr.equals("")) {
			endDate = sf.parse(EncCommonHelper.getNextDateStr(endDateStr,
					"yyyy-MM-dd"));
		}

		ClieUserBean ub = EncCommonHelper.getClieUserAccount(request);
		int perPageNum = EncCommonHelper.getPageSize(request);
		int total = 0;
		List list = this.businessBillDao.getPayListCount(ub.getUser()
				.getClieId(), startDate, endDate);
		BigDecimal costTotal = new BigDecimal(0);
		if (!list.isEmpty() && list.get(0) != null) {
			Object[] pageno = (Object[]) list.get(0);
			if (pageno[0] != null) {
				total = Integer.parseInt(pageno[0].toString());
			}

			if (pageno[1] != null) {
				costTotal = (BigDecimal) pageno[1];
			}
		}

		int pageno1 = EncCommonHelper.getCurrentPageIndex(request, total,
				perPageNum);
		int startIndex = (pageno1 - 1) * perPageNum;
		list = this.businessBillDao.getPayList(ub.getUser().getClieId(),
				startDate, endDate, startIndex, perPageNum);
		mv.addObject("qr", EncCommonHelper.parseQueryResult(list, total,
				perPageNum, pageno1));
		mv.addObject("startDate", startDateStr);
		mv.addObject("endDate", endDateStr);
		mv.addObject("baList", this.bankAccountDao.getList("", ""));
		mv.addObject("costTotal", costTotal);
		return mv;
	}

	public ModelAndView handleBusiAccoForm(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		Date now = new Date();
		SimpleDateFormat dateSf = new SimpleDateFormat("yyyy-MM-dd");
		String endDate = dateSf.format(now);
		return (new ModelAndView(this.busiAccoFormView)).addObject("endDate",
				endDate);
	}

	public ModelAndView handleBusiAcco(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String contentType = request.getParameter("content_type");
		List mtList = this.makeTypeDao.getList(false);
		ClieUserBean ub = EncCommonHelper.getClieUserAccount(request);
		ArrayList arr = new ArrayList();
		Establishment est = ub.getClie();
		List contactList = this.establishmentContactDao.getList(est.getId());
		EstablishmentContact contact = null;
		if (contactList.size() > 0) {
			contact = (EstablishmentContact) contactList.get(0);
		}

		QueryParameterBean b = EncBusinessBillMACtrHelper
				.handleListForAccountCost(request, "ONLINE",
						String.valueOf(ub.getUser().getClieId()),
						this.dataSource);
		List list = this.queryDao.doQuery(b.getQParas(),
				(OrderParameterCarrier[]) null, (String[]) null,
				b.getShortNameMap(), b.getRetObjs(), (String[]) null).getList();
		BigDecimal costTotal = new BigDecimal(0);
		BigDecimal collectTotal = new BigDecimal(0);
		BigDecimal adjustTotal = new BigDecimal(0);
		BigDecimal favTotal = new BigDecimal(0);
		if (list != null && !list.isEmpty()) {
			Object[] qr = (Object[]) list.get(0);
			if (qr[0] != null) {
				costTotal = (BigDecimal) qr[0];
			}

			if (qr[1] != null) {
				collectTotal = (BigDecimal) qr[1];
			}

			if (qr[2] != null) {
				adjustTotal = (BigDecimal) qr[2];
			}

			if (qr[3] != null) {
				favTotal = (BigDecimal) qr[3];
			}
		}

		b = EncBusinessBillMACtrHelper.handleListForAccountList(request,
				"ONLINE", String.valueOf(ub.getUser().getClieId()),
				this.dataSource);
		QueryResult qr1 = this.queryDao.doQuery(b.getQParas(), b.getOParas(),
				(String[]) null, b.getShortNameMap(), b.getRetObjs(),
				(String[]) null);
		Object[] objs = new Object[]{qr1.getList(), est, contact, costTotal,
				collectTotal, adjustTotal, favTotal,
				costTotal.add(adjustTotal).subtract(collectTotal)};
		arr.add(objs);
		if (contentType != null
				&& (contentType.equals("EXCEL") || contentType
						.equals("EXCEL_PRINT"))) {
			HashMap mv1 = new HashMap();
			mv1.put("list", arr);
			mv1.put("mtList", mtList);
			mv1.put("start_date", request.getParameter("start_date"));
			mv1.put("end_date", request.getParameter("end_date"));
			mv1.put("include_sub", "1");
			if (contentType.equals("EXCEL_PRINT")) {
				BusinessBillListForAccountPrintExcelView v1 = new BusinessBillListForAccountPrintExcelView();
				return new ModelAndView(v1, mv1);
			} else {
				BusinessBillListForAccountExcelView v = new BusinessBillListForAccountExcelView();
				return new ModelAndView(v, mv1);
			}
		} else {
			ModelAndView mv = new ModelAndView(this.busiAccoView);
			mv.addAllObjects(b.getParameters());
			mv.addObject("record", arr.get(0));
			mv.addObject("itemTotal", Integer.valueOf(qr1.getList().size()));
			mv.addObject("mtList", mtList);
			mv.addObject("codeRule", this.codeRuleDao.get("BUSINESS_BILL"));
			return mv;
		}
	}

	public AccessoryDao getAccessoryDao() {
		return this.accessoryDao;
	}

	public void setAccessoryDao(AccessoryDao accessoryDao) {
		this.accessoryDao = accessoryDao;
	}

	public BusinessBillDao getBusinessBillDao() {
		return this.businessBillDao;
	}

	public void setBusinessBillDao(BusinessBillDao businessBillDao) {
		this.businessBillDao = businessBillDao;
	}

	public BusinessBillItemDao getBusinessBillItemDao() {
		return this.businessBillItemDao;
	}

	public void setBusinessBillItemDao(BusinessBillItemDao businessBillItemDao) {
		this.businessBillItemDao = businessBillItemDao;
	}

	public String getListForAccessoryView() {
		return this.listForAccessoryView;
	}

	public void setListForAccessoryView(String listForAccessoryView) {
		this.listForAccessoryView = listForAccessoryView;
	}

	public String getInfoForAccessoryView() {
		return this.infoForAccessoryView;
	}

	public void setInfoForAccessoryView(String infoForAccessoryView) {
		this.infoForAccessoryView = infoForAccessoryView;
	}

	public String getListForUnExamineView() {
		return this.listForUnExamineView;
	}

	public void setListForUnExamineView(String listForUnExamineView) {
		this.listForUnExamineView = listForUnExamineView;
	}

	public String getListForReorderView() {
		return this.listForReorderView;
	}

	public void setListForReorderView(String listForReorderView) {
		this.listForReorderView = listForReorderView;
	}

	public String getListForMakeView() {
		return this.listForMakeView;
	}

	public void setListForMakeView(String listForMakeView) {
		this.listForMakeView = listForMakeView;
	}

	public String getListForSelectView() {
		return this.listForSelectView;
	}

	public void setListForSelectView(String listForSelectView) {
		this.listForSelectView = listForSelectView;
	}

	public String getListForDeliverView() {
		return this.listForDeliverView;
	}

	public void setListForDeliverView(String listForDeliverView) {
		this.listForDeliverView = listForDeliverView;
	}

	public String getSearchResultView() {
		return this.searchResultView;
	}

	public void setSearchResultView(String searchResultView) {
		this.searchResultView = searchResultView;
	}

	public QueryDao getQueryDao() {
		return this.queryDao;
	}

	public void setQueryDao(QueryDao queryDao) {
		this.queryDao = queryDao;
	}

	public DepartmentDao getDepartmentDao() {
		return this.departmentDao;
	}

	public void setDepartmentDao(DepartmentDao departmentDao) {
		this.departmentDao = departmentDao;
	}

	public String getPrintView() {
		return this.printView;
	}

	public void setPrintView(String printView) {
		this.printView = printView;
	}

	public String getReceivableListView() {
		return this.receivableListView;
	}

	public void setReceivableListView(String receivableListView) {
		this.receivableListView = receivableListView;
	}

	public AreaDao getAreaDao() {
		return this.areaDao;
	}

	public void setAreaDao(AreaDao areaDao) {
		this.areaDao = areaDao;
	}

	public String getInfoForCompleteView() {
		return this.infoForCompleteView;
	}

	public void setInfoForCompleteView(String infoForCompleteView) {
		this.infoForCompleteView = infoForCompleteView;
	}

	public String getListForCompleteView() {
		return this.listForCompleteView;
	}

	public void setListForCompleteView(String listForCompleteView) {
		this.listForCompleteView = listForCompleteView;
	}

	public String getListForReceiveView() {
		return this.listForReceiveView;
	}

	public void setListForReceiveView(String listForReceiveView) {
		this.listForReceiveView = listForReceiveView;
	}

	public String getListForEstablishmentView() {
		return this.listForEstablishmentView;
	}

	public void setListForEstablishmentView(String listForEstablishmentView) {
		this.listForEstablishmentView = listForEstablishmentView;
	}

	public String getPrintSimpleView() {
		return this.printSimpleView;
	}

	public void setPrintSimpleView(String printSimpleView) {
		this.printSimpleView = printSimpleView;
	}

	public MakeTypeDao getMakeTypeDao() {
		return this.makeTypeDao;
	}

	public void setMakeTypeDao(MakeTypeDao makeTypeDao) {
		this.makeTypeDao = makeTypeDao;
	}

	public String getItemListForEstablishmentView() {
		return this.itemListForEstablishmentView;
	}

	public void setItemListForEstablishmentView(
			String itemListForEstablishmentView) {
		this.itemListForEstablishmentView = itemListForEstablishmentView;
	}

	public AdjustBillItemDao getAdjustBillItemDao() {
		return this.adjustBillItemDao;
	}

	public void setAdjustBillItemDao(AdjustBillItemDao adjustBillItemDao) {
		this.adjustBillItemDao = adjustBillItemDao;
	}

	public ReceiveBillItemDao getReceiveBillItemDao() {
		return this.receiveBillItemDao;
	}

	public void setReceiveBillItemDao(ReceiveBillItemDao receiveBillItemDao) {
		this.receiveBillItemDao = receiveBillItemDao;
	}

	public String getListForEditPriceView() {
		return this.listForEditPriceView;
	}

	public void setListForEditPriceView(String listForEditPriceView) {
		this.listForEditPriceView = listForEditPriceView;
	}

	public String getItemListAloneView() {
		return this.itemListAloneView;
	}

	public void setItemListAloneView(String itemListAloneView) {
		this.itemListAloneView = itemListAloneView;
	}

	public AdjustBillDao getAdjustBillDao() {
		return this.adjustBillDao;
	}

	public void setAdjustBillDao(AdjustBillDao adjustBillDao) {
		this.adjustBillDao = adjustBillDao;
	}

	public ReceiveBillDao getReceiveBillDao() {
		return this.receiveBillDao;
	}

	public void setReceiveBillDao(ReceiveBillDao receiveBillDao) {
		this.receiveBillDao = receiveBillDao;
	}

	public BusinessBillService getBusinessBillService() {
		return this.businessBillService;
	}

	public void setBusinessBillService(BusinessBillService businessBillService) {
		this.businessBillService = businessBillService;
	}

	public String getItemListForSelectView() {
		return this.itemListForSelectView;
	}

	public void setItemListForSelectView(String itemListForSelectView) {
		this.itemListForSelectView = itemListForSelectView;
	}

	public DataSource getDataSource() {
		return this.dataSource;
	}

	public void setDataSource(DataSource dataSource) {
		this.dataSource = dataSource;
	}

	public EstablishmentLevelDao getEstablishmentLevelDao() {
		return this.establishmentLevelDao;
	}

	public void setEstablishmentLevelDao(
			EstablishmentLevelDao establishmentLevelDao) {
		this.establishmentLevelDao = establishmentLevelDao;
	}

	public EstablishmentTypeDao getEstablishmentTypeDao() {
		return this.establishmentTypeDao;
	}

	public void setEstablishmentTypeDao(
			EstablishmentTypeDao establishmentTypeDao) {
		this.establishmentTypeDao = establishmentTypeDao;
	}

	public String getListForModifyView() {
		return this.listForModifyView;
	}

	public void setListForModifyView(String listForModifyView) {
		this.listForModifyView = listForModifyView;
	}

	public BankAccountBalanceDao getBankAccountBalanceDao() {
		return this.bankAccountBalanceDao;
	}

	public void setBankAccountBalanceDao(
			BankAccountBalanceDao bankAccountBalanceDao) {
		this.bankAccountBalanceDao = bankAccountBalanceDao;
	}

	public BankAccountDetailDao getBankAccountDetailDao() {
		return this.bankAccountDetailDao;
	}

	public void setBankAccountDetailDao(
			BankAccountDetailDao bankAccountDetailDao) {
		this.bankAccountDetailDao = bankAccountDetailDao;
	}

	public IdGenerator getIdGenerator() {
		return this.idGenerator;
	}

	public void setIdGenerator(IdGenerator idGenerator) {
		this.idGenerator = idGenerator;
	}

	public TallySetDao getTallySetDao() {
		return this.tallySetDao;
	}

	public void setTallySetDao(TallySetDao tallySetDao) {
		this.tallySetDao = tallySetDao;
	}

	public String getSelectMakerView() {
		return this.selectMakerView;
	}

	public void setSelectMakerView(String selectMakerView) {
		this.selectMakerView = selectMakerView;
	}

	public String getListForAccountFormView() {
		return this.listForAccountFormView;
	}

	public void setListForAccountFormView(String listForAccountFormView) {
		this.listForAccountFormView = listForAccountFormView;
	}

	public String getItemListForCooperSelectView() {
		return this.itemListForCooperSelectView;
	}

	public void setItemListForCooperSelectView(
			String itemListForCooperSelectView) {
		this.itemListForCooperSelectView = itemListForCooperSelectView;
	}

	public EstablishmentContactDao getEstablishmentContactDao() {
		return this.establishmentContactDao;
	}

	public void setEstablishmentContactDao(
			EstablishmentContactDao establishmentContactDao) {
		this.establishmentContactDao = establishmentContactDao;
	}

	public String getInfoForCloseView() {
		return this.infoForCloseView;
	}

	public void setInfoForCloseView(String infoForCloseView) {
		this.infoForCloseView = infoForCloseView;
	}

	public String getListForCloseView() {
		return this.listForCloseView;
	}

	public void setListForCloseView(String listForCloseView) {
		this.listForCloseView = listForCloseView;
	}

	public String getInfoForUnCloseView() {
		return this.infoForUnCloseView;
	}

	public void setInfoForUnCloseView(String infoForUnCloseView) {
		this.infoForUnCloseView = infoForUnCloseView;
	}

	public String getListForUnCloseView() {
		return this.listForUnCloseView;
	}

	public void setListForUnCloseView(String listForUnCloseView) {
		this.listForUnCloseView = listForUnCloseView;
	}

	public String getInfoForUnCompleteView() {
		return this.infoForUnCompleteView;
	}

	public void setInfoForUnCompleteView(String infoForUnCompleteView) {
		this.infoForUnCompleteView = infoForUnCompleteView;
	}

	public String getListForUnCompleteView() {
		return this.listForUnCompleteView;
	}

	public void setListForUnCompleteView(String listForUnCompleteView) {
		this.listForUnCompleteView = listForUnCompleteView;
	}

	public SmsAlertDao getSmsAlertDao() {
		return this.smsAlertDao;
	}

	public void setSmsAlertDao(SmsAlertDao smsAlertDao) {
		this.smsAlertDao = smsAlertDao;
	}

	public String getPrintLittleView() {
		return this.printLittleView;
	}

	public void setPrintLittleView(String printLittleView) {
		this.printLittleView = printLittleView;
	}

	public CooperBillItemDao getCooperBillItemDao() {
		return this.cooperBillItemDao;
	}

	public void setCooperBillItemDao(CooperBillItemDao cooperBillItemDao) {
		this.cooperBillItemDao = cooperBillItemDao;
	}

	public FeeBillDao getFeeBillDao() {
		return this.feeBillDao;
	}

	public void setFeeBillDao(FeeBillDao feeBillDao) {
		this.feeBillDao = feeBillDao;
	}

	public StockDao getStockDao() {
		return this.stockDao;
	}

	public void setStockDao(StockDao stockDao) {
		this.stockDao = stockDao;
	}

	public String getProfitSearchResultView() {
		return this.profitSearchResultView;
	}

	public void setProfitSearchResultView(String profitSearchResultView) {
		this.profitSearchResultView = profitSearchResultView;
	}

	public CodeRuleDao getCodeRuleDao() {
		return this.codeRuleDao;
	}

	public void setCodeRuleDao(CodeRuleDao codeRuleDao) {
		this.codeRuleDao = codeRuleDao;
	}

	public MessageDao getMessageDao() {
		return this.messageDao;
	}

	public void setMessageDao(MessageDao messageDao) {
		this.messageDao = messageDao;
	}

	public FinanceDetailDao getFinanceDetailDao() {
		return this.financeDetailDao;
	}

	public void setFinanceDetailDao(FinanceDetailDao financeDetailDao) {
		this.financeDetailDao = financeDetailDao;
	}

	public WorkCenterDao getWorkCenterDao() {
		return this.workCenterDao;
	}

	public void setWorkCenterDao(WorkCenterDao workCenterDao) {
		this.workCenterDao = workCenterDao;
	}

	public String getPrintMakeView() {
		return this.printMakeView;
	}

	public void setPrintMakeView(String printMakeView) {
		this.printMakeView = printMakeView;
	}

	public OutBillDao getOutBillDao() {
		return this.outBillDao;
	}

	public void setOutBillDao(OutBillDao outBillDao) {
		this.outBillDao = outBillDao;
	}

	public String getListForOutputView() {
		return this.listForOutputView;
	}

	public void setListForOutputView(String listForOutputView) {
		this.listForOutputView = listForOutputView;
	}

	public String getInfoView() {
		return this.infoView;
	}

	public void setInfoView(String infoView) {
		this.infoView = infoView;
	}

	public BusinessUpdateLogDao getBusinessUpdateLogDao() {
		return this.businessUpdateLogDao;
	}

	public void setBusinessUpdateLogDao(
			BusinessUpdateLogDao businessUpdateLogDao) {
		this.businessUpdateLogDao = businessUpdateLogDao;
	}

	public String getByDateForReceiveView() {
		return this.byDateForReceiveView;
	}

	public void setByDateForReceiveView(String byDateForReceiveView) {
		this.byDateForReceiveView = byDateForReceiveView;
	}

	public OutputDao getOutputDao() {
		return this.outputDao;
	}

	public void setOutputDao(OutputDao outputDao) {
		this.outputDao = outputDao;
	}

	public WorkProcessDao getWorkProcessDao() {
		return this.workProcessDao;
	}

	public void setWorkProcessDao(WorkProcessDao workProcessDao) {
		this.workProcessDao = workProcessDao;
	}

	public PayModeDao getPayModeDao() {
		return this.payModeDao;
	}

	public void setPayModeDao(PayModeDao payModeDao) {
		this.payModeDao = payModeDao;
	}

	public BankAccountDao getBankAccountDao() {
		return this.bankAccountDao;
	}

	public void setBankAccountDao(BankAccountDao bankAccountDao) {
		this.bankAccountDao = bankAccountDao;
	}

	public FeeTypeDao getFeeTypeDao() {
		return this.feeTypeDao;
	}

	public void setFeeTypeDao(FeeTypeDao feeTypeDao) {
		this.feeTypeDao = feeTypeDao;
	}

	public String getMtBusinessDateView() {
		return this.mtBusinessDateView;
	}

	public void setMtBusinessDateView(String mtBusinessDateView) {
		this.mtBusinessDateView = mtBusinessDateView;
	}

	public String getBusinessDateCountPrintView() {
		return this.businessDateCountPrintView;
	}

	public void setBusinessDateCountPrintView(String businessDateCountPrintView) {
		this.businessDateCountPrintView = businessDateCountPrintView;
	}
}